:root {
    --bg: #f4f6fa;
    --panel: #ffffff;
    --text: #182235;
    --muted: #6b7688;
    --line: #e3e8f0;
    --nav: #101d32;
    --nav-soft: #1a2b49;
    --blue: #2367f2;
    --green: #0f8f5f;
    --red: #be3434;
    --amber: #9d6a08;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

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

.sidebar {
    background: var(--nav);
    color: #dce6f7;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 4px 6px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.brand-logo {
    width: 154px;
    height: 43px;
    object-fit: contain;
    object-position: left center;
    flex: 0 0 auto;
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    color: #fff;
    line-height: 1.15;
}

.brand small {
    margin-top: 2px;
    color: #8fa4c2;
    font-size: 12px;
}

.nav {
    display: grid;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    color: #c7d4e8;
}

.nav-item:hover,
.nav-item.is-active {
    background: var(--nav-soft);
    color: #fff;
}

.nav-item.is-disabled {
    opacity: .46;
    cursor: default;
}

.sidebar-foot {
    margin-top: auto;
    display: grid;
    gap: 8px;
    font-size: 13px;
    color: #8fa4c2;
}

.main {
    min-width: 0;
    padding: 28px;
}

.topbar,
.toolbar,
.panel-head,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.topbar {
    margin-bottom: 18px;
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.topbar p {
    margin: 5px 0 0;
    color: var(--muted);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}

.user-box a {
    color: var(--blue);
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.alert-success {
    border-color: #bfe6d3;
    background: #effaf5;
    color: #0a6f48;
}

.alert-danger {
    border-color: #efc3c3;
    background: #fff3f3;
    color: var(--red);
}

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

.metric-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(17, 31, 55, .04);
}

.metric-card {
    padding: 18px;
}

.metric-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

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

.metric-card small {
    display: block;
    margin-top: 8px;
}

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

.dashboard-two-col {
    margin-bottom: 0;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.panel {
    padding: 18px;
}

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

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

.muted,
small {
    color: var(--muted);
}

.toolbar {
    margin-bottom: 16px;
}

.blog-ai-workbench {
    align-items: start;
}

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

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfd7e5;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    min-height: 40px;
    padding: 8px 11px;
}

textarea {
    resize: vertical;
}

.filters input {
    width: 260px;
}

.filters select {
    width: 160px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-light {
    background: #fff;
    border-color: #cfd7e5;
    color: #26364d;
}

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

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 30px 12px !important;
}

.actions-col {
    width: 130px;
    white-space: nowrap;
}

.actions-col form {
    display: inline;
}

.link {
    border: 0;
    background: transparent;
    color: var(--blue);
    padding: 0;
    cursor: pointer;
}

.link.danger {
    color: var(--red);
    margin-left: 10px;
}

.actions-col .link + .link {
    margin-left: 10px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: #eef2f7;
    color: #536073;
}

.status-active {
    background: #e9f8f1;
    color: var(--green);
}

.status-paused {
    background: #fff6dd;
    color: var(--amber);
}

.status-archived {
    background: #eef2f7;
    color: #657286;
}

.status-published,
.status-indexed,
.status-index,
.status-generated,
.status-connected,
.status-success {
    background: #e9f8f1;
    color: var(--green);
}

.status-draft,
.status-auto,
.status-unknown,
.status-keyword_ready,
.status-discovered,
.status-generating,
.status-pending,
.status-todo,
.status-queued,
.status-running,
.status-scheduled,
.status-publishing,
.status-retrying {
    background: #eef5ff;
    color: #2459b8;
}

.status-partial,
.status-skipped,
.status-doing,
.status-priority-high {
    background: #fff6dd;
    color: var(--amber);
}

.status-not_published,
.status-not_indexed,
.status-noindex,
.status-failed,
.status-disconnected,
.status-overdue,
.status-canceled,
.status-priority-urgent {
    background: #fff3f3;
    color: var(--red);
}

.status-done,
.status-finished {
    background: #e9f8f1;
    color: var(--green);
}

.status-priority-low,
.status-priority-normal {
    background: #eef2f7;
    color: #536073;
}

.type-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef2f7;
    color: #344258;
    font-size: 12px;
    font-weight: 800;
}

.count-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 210px;
}

.count-pills span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #eef2f7;
    color: #344258;
    font-size: 12px;
    font-weight: 800;
}

.run-pills {
    max-width: 300px;
}

.run-pills span {
    font-size: 11px;
    padding: 0 7px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    display: inline-block;
    background: #9aa6b6;
}

.status-dot-success {
    background: var(--green);
}

.status-dot-partial,
.status-dot-skipped {
    background: var(--amber);
}

.status-dot-failed {
    background: var(--red);
}

.status-dot-running {
    background: var(--blue);
}

.sync-error {
    display: block;
    max-width: 280px;
    color: var(--red);
    line-height: 1.45;
}

.seo-overview-table th,
.seo-overview-table td {
    vertical-align: top;
}

.overview-pills {
    max-width: 260px;
}

.progress-stack {
    display: grid;
    gap: 6px;
    min-width: 140px;
}

.progress-stack .progress {
    width: 150px;
    margin-right: 0;
}

.type-tag {
    background: #e9f8f1;
    color: var(--green);
}

.type-blog {
    background: #eef5ff;
    color: #2459b8;
}

.type-product {
    background: #f0ebff;
    color: #5b3bb2;
}

.type-news {
    background: #fff6dd;
    color: var(--amber);
}

.type-page {
    background: #eef2f7;
    color: #536073;
}

.type-wordpress {
    background: #eef5ff;
    color: #2459b8;
}

.type-tag_tools {
    background: #e9f8f1;
    color: var(--green);
}

.type-blog_system {
    background: #f0ebff;
    color: #5b3bb2;
}

.type-gsc {
    background: #fff6dd;
    color: var(--amber);
}

.table-url {
    color: var(--blue);
    font-size: 12px;
    word-break: break-all;
}

.compact-table th,
.compact-table td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.progress {
    height: 9px;
    width: 130px;
    border-radius: 999px;
    background: #edf2f8;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.progress i {
    display: block;
    height: 100%;
    background: var(--blue);
}

.context-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: #f6f9fd;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 18px;
}

.context-card strong,
.context-card span {
    display: block;
}

.context-card span {
    color: var(--muted);
}

.info-list,
.steps-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.info-list div,
.steps-grid article {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafd;
}

.info-list span,
.info-list strong,
.info-list small,
.steps-grid strong,
.steps-grid p {
    display: block;
}

.info-list span {
    color: var(--muted);
    margin-bottom: 6px;
}

.info-list strong {
    word-break: break-all;
}

.info-list small {
    margin-top: 8px;
}

.steps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 0;
}

.steps-grid p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.form-panel {
    max-width: 980px;
}

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

.compact-form {
    gap: 12px;
}

.form-grid label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.form-grid label span {
    color: #344258;
}

.form-grid label small {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.45;
}

.section-label {
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.section-label span {
    font-size: 16px;
}

.form-grid .checkbox-label {
    grid-template-columns: 18px 1fr;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding-top: 22px;
}

.form-grid .checkbox-label input {
    width: 18px;
    height: 18px;
}

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

.checkbox-list label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    font-weight: 600;
}

.checkbox-list input {
    width: 16px;
    height: 16px;
    min-height: 16px;
    padding: 0;
}

.tag-picker {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    background: #f8fafc;
}

.tag-picker-head,
.tag-picker-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tag-picker-head span {
    display: block;
    color: #344258;
    font-weight: 800;
}

.tag-picker-head small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 500;
}

.tag-picker-head strong {
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
}

.tag-picker-head b {
    color: var(--accent);
    font-size: 18px;
}

.tag-picker-tools input,
.tag-picker-tools select {
    flex: 1;
    min-width: 180px;
}

.tag-picker-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-height: 360px;
    overflow: auto;
    padding: 2px;
}

.tag-picker-list[data-visible-count="0"]::after {
    content: "当前站点没有可显示的 Tag";
    grid-column: 1 / -1;
    padding: 18px;
    color: var(--muted);
    text-align: center;
    border: 1px dashed var(--line);
    background: #ffffff;
}

.form-grid .tag-picker-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 10px;
    border: 1px solid var(--line);
    background: #ffffff;
    font-weight: 600;
}

.tag-picker-item input {
    width: 16px;
    height: 16px;
    padding: 0;
}

.tag-picker-item strong,
.tag-picker-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-picker-item small {
    margin-top: 3px;
    color: var(--muted);
    font-weight: 500;
}

.tag-picker-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    font-weight: 700;
}

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

.tag-selected-chip {
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: #344258;
    font-weight: 700;
    cursor: pointer;
}

.tag-selected-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

.form-actions {
    justify-content: flex-end;
    padding-top: 6px;
}

.danger-zone {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    text-align: right;
}

.asset-bars {
    display: grid;
    gap: 12px;
}

.asset-bar {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 12px;
}

.asset-bar-wide {
    grid-template-columns: 92px minmax(0, 1fr) 82px;
}

.asset-bar strong {
    text-align: right;
}

.asset-bar div {
    height: 10px;
    border-radius: 999px;
    background: #edf2f8;
    overflow: hidden;
}

.asset-bar i {
    display: block;
    height: 100%;
    min-width: 4px;
    background: var(--blue);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background: #eef3f9;
}

.login-card {
    width: min(920px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 22px 60px rgba(17, 31, 55, .12);
}

.login-hero {
    background: var(--nav);
    color: #fff;
    padding: 56px 48px;
}

.login-logo {
    width: min(260px, 100%);
    height: 126px;
    object-fit: contain;
    object-position: left center;
    display: block;
    margin-bottom: 28px;
}

.login-hero span {
    color: #9ec5ff;
    font-weight: 800;
}

.login-hero h1 {
    margin: 22px 0 12px;
    font-size: 48px;
}

.login-hero p {
    color: #cbd8ec;
    line-height: 1.8;
    margin: 0;
}

.login-panel {
    padding: 48px;
}

.login-panel h2 {
    margin: 0 0 22px;
}

.form-stack {
    display: grid;
    gap: 16px;
}

.form-stack label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.tag-settings-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
    gap: 18px;
    margin-bottom: 18px;
}

.tag-settings-title,
.tag-site-card,
.tag-config-panel,
.tag-operation-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(17, 31, 55, .04);
}

.tag-settings-title {
    padding: 22px;
}

.tag-settings-title h2 {
    margin: 12px 0 7px;
    font-size: 22px;
}

.tag-settings-title p,
.tag-card-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.tag-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.tag-hero-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid #dce5f2;
    border-radius: 8px;
    background: #f8fafd;
    color: #526176;
    font-size: 12px;
    font-weight: 700;
}

.tag-hero-stats strong {
    color: var(--text);
    font-size: 14px;
}

.tag-site-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    padding: 16px;
}

.tag-site-card label,
.tag-ops-form label,
.tag-number-grid label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.tag-site-card label span,
.tag-ops-form label span,
.tag-number-grid label span {
    color: #344258;
}

.tag-site-card select {
    min-width: 0;
}

.tag-site-card .status {
    justify-self: start;
    width: fit-content;
}

.tag-site-meta {
    grid-column: 1 / -1;
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid #dce5f2;
    border-radius: 8px;
    background: #f8fafd;
}

.tag-site-meta strong,
.tag-site-meta small {
    display: block;
    word-break: break-all;
}

.tag-site-empty {
    align-items: center;
}

.tag-settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(360px, .72fr);
    gap: 18px;
}

.tag-config-panel,
.tag-operation-card {
    padding: 18px;
}

.tag-card-head {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.tag-card-head > span {
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
}

.tag-card-head h2 {
    margin: 0;
    font-size: 18px;
}

.tag-settings-form,
.tag-ops-form,
.tag-ops-stack {
    display: grid;
    gap: 16px;
}

.tag-field-block {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.tag-field-title {
    display: grid;
    gap: 4px;
}

.tag-field-title small,
.tag-ops-form small {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.45;
}

.tag-number-grid,
.tag-inline-fields,
.inline-fields,
.tag-switch-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.tag-switch-grid {
    grid-template-columns: 1fr;
}

.compact-info {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 16px 0 0;
}

.tag-switch {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 13px;
    border: 1px solid #dce5f2;
    border-radius: 8px;
    background: #f8fafd;
    font-weight: 600;
}

.tag-switch input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    margin-top: 2px;
}

.tag-switch span,
.tag-switch strong,
.tag-switch small {
    display: block;
}

.tag-switch strong {
    margin-bottom: 4px;
}

.tag-switch small {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.45;
}

.tag-switch-compact {
    margin-top: -2px;
}

.tag-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 2px;
}

@media (max-width: 1120px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .two-col,
    .tag-settings-hero,
    .tag-settings-layout {
        grid-template-columns: 1fr;
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        position: static;
    }

    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main {
        padding: 18px;
    }

    .tag-site-card {
        grid-template-columns: 1fr;
    }

    .tag-actions .btn {
        width: 100%;
    }

    .topbar,
    .toolbar,
    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-grid,
    .info-list,
    .form-grid,
    .tag-number-grid,
    .tag-inline-fields,
    .inline-fields,
    .tag-picker-list,
    .login-card {
        grid-template-columns: 1fr;
    }

    .filters,
    .filters input,
    .filters select {
        width: 100%;
    }

    .tag-picker-head,
    .tag-picker-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .tag-picker-tools input,
    .tag-picker-tools select,
    .tag-picker-tools .btn {
        width: 100%;
    }
}
