:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1d2433;
    --muted: #697386;
    --line: #dce2ea;
    --primary: #1769e0;
    --primary-dark: #1053b5;
    --danger: #d92d20;
    --success-bg: #e8f5ed;
    --success-text: #1b7642;
    --error-bg: #fdecec;
    --error-text: #b42318;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
button, .primary {
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
button:hover, .primary:hover { background: var(--primary-dark); color: #fff; }
button:disabled {
    background: #e4e7ec;
    color: #98a2b3;
    border-color: #e4e7ec;
    cursor: not-allowed;
}
button[formaction*="delete"], .actions button { background: #fff; color: var(--danger); border: 1px solid #f0b8b2; }
button[formaction*="delete"]:hover, .actions button:hover { background: #fff4f3; }
button.plain, .actions button.plain { background: #fff; color: var(--primary); border: 1px solid var(--line); }
button.plain:hover, .actions button.plain:hover { background: #f5f8ff; color: var(--primary-dark); }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    font: inherit;
    background: #fff;
}
input[type="radio"], input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 7px; font-weight: 600; color: #344054; }
small { display: block; color: var(--muted); line-height: 1.6; word-break: break-all; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 220px;
    background: #111827;
    color: #fff;
    padding: 18px 12px;
    overflow-y: auto;
}
.brand {
    font-size: 18px;
    font-weight: 700;
    padding: 8px 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 10px;
}
.sidebar nav a {
    display: block;
    color: #d8dee9;
    padding: 10px 12px;
    border-radius: 6px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.main { margin-left: 220px; padding: 24px; min-width: 980px; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.topbar h1 { margin: 0 0 6px; font-size: 24px; }
.topbar p { margin: 0; color: var(--muted); }
.admin-user { color: var(--muted); display: flex; gap: 10px; align-items: center; }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 16px;
    overflow-x: auto;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.toolbar, .batch, .filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.batch select, .batch input, .filters select, .filters input { width: auto; min-width: 140px; }
.resource-batch input { width: 120px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}
.stat span { display: block; color: var(--muted); margin-bottom: 8px; }
.stat strong { font-size: 28px; }
.grid.two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.home-top {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
    gap: 16px;
}
.home-card {
    padding: 0;
    border-color: #e8ddc9;
    overflow: hidden;
}
.home-card .panel-head {
    padding: 18px 22px;
    border-bottom: 1px solid #eadfcd;
    margin: 0;
}
.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 26px;
}
.quick-grid a {
    min-height: 86px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f8f6ee, #ece7d8);
    color: #566f5b;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.quick-grid a.active {
    background: #5f7f64;
    color: #fff;
}
.quick-grid span {
    font-size: 30px;
    line-height: 1;
}
.quick-grid strong { font-weight: 500; }
.dot-pair { display: flex; gap: 7px; }
.dot-pair i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #a6a6a6;
    display: block;
}
.dot-pair i + i { background: #ddd; }
.stat-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 26px;
}
.stat-tiles div {
    min-height: 88px;
    border: 1px solid #eadfcd;
    border-radius: 16px;
    padding: 16px;
    background: #fffdf8;
}
.stat-tiles span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}
.stat-tiles strong {
    color: #4e7055;
    font-size: 32px;
}
.latest-card {
    padding: 0;
    border-color: #e8ddc9;
}
.latest-card .panel-head {
    padding: 18px 22px;
    border-bottom: 1px solid #eadfcd;
    margin: 0;
}
.latest-list { padding: 20px 24px; }
.latest-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #edf0f3;
    color: var(--text);
}
.latest-item:last-child { border-bottom: 0; }
.latest-thumb {
    width: 150px;
    height: 68px;
    border-radius: 12px;
    background: #e9eef5;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--muted);
}
.latest-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.latest-item strong {
    display: block;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 4px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.form-grid .wide, .form-actions, .preview { grid-column: 1 / -1; }
.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}
.check input { width: auto; }
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 6px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}
th { color: #475467; background: #f8fafc; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { display: inline; }
.actions a, .actions button {
    padding: 6px 9px;
    min-height: 30px;
    border-radius: 5px;
    font-size: 13px;
}
.thumb {
    width: 88px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
}
.preview img, .detail-cover {
    max-width: 360px;
    max-height: 240px;
    border-radius: 8px;
    border: 1px solid var(--line);
}
.detail dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 16px;
}
.detail dt { color: var(--muted); font-weight: 700; }
.detail dd { margin: 0; word-break: break-all; }
.detail pre {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}
.browse-controls form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.browse-controls label { min-width: 180px; }
.hint { margin: 0; color: var(--muted); }
.sync-progress-panel .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.sync-progress-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}
.sync-job {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    background: #fff;
}
.sync-job.is-running {
    border-color: #91caff;
    background: #f5faff;
}
.sync-job.is-failed {
    border-color: #ffd8a8;
    background: #fffaf2;
}
.sync-job-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.sync-job-top strong { font-size: 15px; }
.sync-job-bar {
    height: 8px;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
}
.sync-job-bar i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #1677ff, #69b1ff);
    transition: width .25s ease;
}
.sync-job.is-failed .sync-job-bar i { background: #fa8c16; }
.sync-job.is-done .sync-job-bar i { background: #52c41a; }
.sync-job-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}
.sync-job-msg {
    margin: 8px 0 0;
    color: #334155;
    font-size: 13px;
}
.sync-progress-empty { padding: 18px 0; }
.browse-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.45fr) minmax(520px, 0.55fr);
    gap: 16px;
    align-items: start;
}
.article-list, .preview-panel { height: calc(100vh - 250px); min-height: 520px; overflow: auto; }
.article-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
}
.article-item.synced { background: #f8fafc; }
.article-item .actions { margin-top: 8px; }
.tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 5px;
    background: #eef4ff;
    color: #175cd3;
    font-size: 13px;
}
.tag.warn {
    background: #fff4e5;
    color: #b54708;
}
.preview-panel input { margin-bottom: 10px; }
.preview-panel iframe {
    width: 100%;
    height: calc(100% - 70px);
    min-height: 430px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.folder-picker {
    grid-column: 1 / -1;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfcfe;
    padding: 14px;
}
.folder-picker-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.folder-picker-summary {
    display: grid;
    gap: 4px;
}
.folder-picker-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.folder-picker-summary strong {
    font-size: 16px;
    word-break: break-all;
}
.folder-picker-panel {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}
.folder-group {
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    background: #fff;
    padding: 12px;
}
.folder-group-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.folder-group-head strong {
    font-size: 14px;
}
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}
.folder-option {
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d6dbe5;
    background: #f8fafc;
    color: #344054;
    text-align: left;
    justify-content: flex-start;
    white-space: normal;
    line-height: 1.4;
}
.folder-option.active {
    border-color: var(--primary);
    background: #edf4ff;
    color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}
.folder-picker-empty {
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
    color: var(--muted);
}
.folder-picker-error {
    padding: 10px 12px;
    border: 1px solid #f0b8b2;
    border-radius: 8px;
    background: var(--error-bg);
    color: var(--error-text);
}
.folder-picker-loading {
    padding: 10px 12px;
    color: var(--muted);
    text-align: center;
}
.folder-picker-actions {
    align-items: center;
}
.folder-picker-actions button {
    min-width: 88px;
}
.rich-content {
    line-height: 1.9;
}
.rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 8px 0;
}
.rich-content p,
.rich-content li,
.rich-content blockquote {
    margin: 0 0 10px;
}
.rich-content figure {
    margin: 12px 0;
}
.content-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.content-tabs button {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
}
.content-tabs button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.content-panel[hidden] {
    display: none !important;
}
.flash-wrap { margin-bottom: 14px; }
.flash {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
}
.flash.success { background: var(--success-bg); color: var(--success-text); }
.flash.error { background: var(--error-bg); color: var(--error-text); }
.flash.info { background: #eef4ff; color: #175cd3; }
.ad-check-page .panel {
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}
.ad-check-filter-panel {
    background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
}
.ad-check-filter-panel .panel-head {
    align-items: flex-start;
}
.ad-check-filter-panel .panel-head .hint {
    margin-top: 6px;
}
.ad-check-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 12px;
}
.ad-account-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ad-account-label {
    font-weight: 600;
    color: #344054;
    font-size: 14px;
}
.ad-account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.ad-account-card {
    position: relative;
    cursor: pointer;
    border: 2px solid #dce3ee;
    border-radius: 12px;
    background: #fff;
    padding: 16px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.ad-account-card:hover {
    border-color: rgba(23, 105, 224, 0.5);
    background: #f7fbff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 105, 224, 0.15);
}
.ad-account-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.ad-account-card input[type="radio"]:checked + .ad-account-card-content {
    color: var(--primary);
}
.ad-account-card input[type="radio"]:checked ~ .ad-account-card-content .ad-account-icon {
    background: var(--primary);
    color: #fff;
}
.ad-account-card:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: #f0f7ff;
}
.ad-account-card-content {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: color 0.2s ease;
}
.ad-account-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #eef4ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.2s ease;
}
.ad-account-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}
.ad-keywords-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ad-keywords-label {
    font-weight: 600;
    color: #344054;
    font-size: 14px;
}
.ad-keywords-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: #f7fbff;
    border-radius: 8px;
    border: 1px solid #d0e5ff;
}
.ad-keywords-history > .hint {
    display: inline-block;
}
.ad-keywords-clear {
    align-self: flex-start;
    padding: 3px 10px;
    border: 1px solid #b8c7dc;
    border-radius: 6px;
    background: #fff;
    color: #667085;
    cursor: pointer;
    font-size: 12px;
}
.ad-keywords-clear:hover {
    color: #d92d20;
    border-color: #fda29b;
}
.ad-keywords-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ad-keyword-tag {
    display: inline-flex;
    align-items: center;
    padding: 0;
    background: #fff;
    border: 1px solid #b8daff;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    overflow: hidden;
}
.ad-keyword-tag:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(23, 105, 224, 0.25);
}
.ad-keyword-add,
.ad-keyword-remove {
    border: 0;
    cursor: pointer;
    font: inherit;
}
.ad-keyword-add {
    padding: 6px 10px 6px 12px;
    background: transparent;
    color: var(--primary);
}
.ad-keyword-add:hover {
    background: var(--primary);
    color: #fff;
}
.ad-keyword-remove {
    padding: 5px 8px 5px 4px;
    background: transparent;
    color: #98a2b3;
    font-size: 16px;
    line-height: 1;
}
.ad-keyword-remove:hover {
    color: #d92d20;
}
.ad-keywords-section textarea {
    min-height: 80px;
}
.ad-folder-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: #f9fafb;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
}
.ad-folder-label {
    font-weight: 600;
    color: #344054;
    font-size: 14px;
}
.ad-folder-value {
    color: var(--primary);
    font-size: 15px;
    font-weight: 500;
    word-break: break-all;
}
.ad-check-form .folder-picker,
.ad-check-actions {
    grid-column: 1 / -1;
}
.ad-check-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e4e7ec;
}
.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.modal-close {
    background: none;
    border: 0;
    font-size: 28px;
    line-height: 1;
    color: #98a2b3;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.modal-close:hover {
    background: #f2f4f7;
    color: #344054;
}
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.folder-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.loading-spinner {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
    animation: spin 2s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.folder-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.folder-modal-option {
    width: 100%;
    padding: 14px 16px;
    text-align: left;
    background: #fff;
    border: 2px solid #d0d5dd;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #344054;
    cursor: pointer;
    transition: all 0.2s ease;
}
.folder-modal-option:hover {
    background: #f0f7ff;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(23, 105, 224, 0.15);
}
.folder-error {
    padding: 20px;
    background: var(--error-bg);
    color: var(--error-text);
    border-radius: 8px;
    text-align: center;
}
.ad-check-page .folder-picker,
.ad-check-page .folder-group {
    background: rgba(255, 255, 255, 0.82);
}
.ad-check-page .folder-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ad-check-page .folder-option {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 12px;
    background: #fff;
    border-color: #dce3ee;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.ad-check-page .folder-option:hover {
    border-color: rgba(23, 105, 224, 0.45);
    background: #f7fbff;
}
.ad-check-page .folder-option input {
    flex: 0 0 auto;
}
.ad-result-toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}
.ad-result-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
}
.ad-result-pagination label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ad-result-pagination select {
    min-width: 68px;
    padding: 6px 8px;
    border: 1px solid #dce3ee;
    border-radius: 7px;
    background: #fff;
}
.ad-result-pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.ad-batch-field {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}
.ad-batch-field input {
    min-width: 130px;
    padding: 7px 9px;
    border: 1px solid #dce3ee;
    border-radius: 8px;
}
.ad-result-list {
    display: grid;
    gap: 10px;
}
.ad-result-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(240px, auto);
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid #dde5f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.ad-result-row:hover {
    border-color: rgba(23, 105, 224, 0.35);
    background: #fbfdff;
}
.ad-result-check {
    display: grid;
    place-items: center;
    width: 36px;
}
.ad-result-check input {
    width: 18px;
    height: 18px;
}
.ad-type-icon,
.ad-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eef4ff;
    color: #175cd3;
    font-size: 12px;
    font-weight: 700;
}
.ad-type-icon {
    width: 28px;
    height: 28px;
}
.ad-type-badge {
    padding: 4px 8px;
}
.ad-result-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.ad-result-title strong {
    word-break: break-all;
}
.ad-result-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 4px;
}
.ad-result-actions {
    justify-self: end;
    min-width: 220px;
}
.ad-rename-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.ad-rename-form input {
    min-width: 150px;
}
.ad-upload-account-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ad-upload-account {
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #dce3ee;
    border-radius: 12px;
    background: #fff;
}
.ad-upload-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ad-upload-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}
.ad-upload-dropzone {
    border: 1px dashed #9aa8bc;
    border-radius: 12px;
    padding: 22px 16px;
    background: #f7f9fc;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.ad-upload-dropzone:hover,
.ad-upload-dropzone.is-dragover {
    border-color: var(--primary);
    background: #eef5ff;
}
.ad-upload-dropzone-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.ad-upload-dropzone-sub {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}
.ad-upload-selected {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}
.ad-upload-selected-list {
    margin: 8px 0 0;
    padding-left: 18px;
    max-height: 220px;
    overflow: auto;
}
.ad-upload-selected-list li {
    margin: 4px 0;
    word-break: break-all;
}
.ad-upload-selected-list code {
    font-size: 13px;
}
.ad-upload-progress {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #b8daff;
    border-radius: 8px;
    background: #f7fbff;
}
.ad-upload-progress-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: #175cd3;
    font-size: 13px;
}
.ad-upload-progress progress {
    width: 100%;
    height: 10px;
    accent-color: var(--primary);
}
@media (max-width: 1100px) {
    .ad-check-form,
    .ad-result-row {
        grid-template-columns: 1fr;
    }
    .ad-result-check {
        place-items: start;
        width: auto;
    }
    .ad-result-actions {
        justify-self: stretch;
        min-width: 0;
    }
    .ad-rename-form {
        flex-wrap: wrap;
    }
}
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(23, 105, 224, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.98)),
        #0f172a;
    padding: 24px;
}
.login-shell {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 420px);
    gap: 28px;
    align-items: stretch;
}
.login-hero {
    color: #fff;
    padding: 48px 24px 48px 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #dbeafe;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.login-hero h1 {
    margin: 18px 0 16px;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.08;
    letter-spacing: -0.03em;
    max-width: 11ch;
}
.login-hero p {
    margin: 0;
    max-width: 44ch;
    color: rgba(255, 255, 255, 0.76);
    line-height: 1.8;
    font-size: 15px;
}
.login-features {
    list-style: none;
    padding: 0;
    margin: 26px 0 0;
    display: grid;
    gap: 12px;
    max-width: 420px;
}
.login-features li {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}
.login-box {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 24px;
    padding: 32px;
    display: grid;
    gap: 16px;
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.35);
    backdrop-filter: blur(16px);
}
.login-card-head {
    display: grid;
    gap: 8px;
    margin-bottom: 4px;
}
.login-badge {
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e8f0ff;
    color: #175cd3;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.login-card-head h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.02em;
}
.login-card-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}
.login-box label {
    gap: 8px;
    font-size: 14px;
}
.login-box input {
    border-radius: 14px;
    border: 1px solid #d6dbe5;
    background: #fbfcfe;
    padding: 13px 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.login-box input:focus {
    outline: none;
    border-color: rgba(23, 105, 224, 0.55);
    box-shadow: 0 0 0 4px rgba(23, 105, 224, 0.12);
}
.login-submit {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    margin-top: 4px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
@media (max-width: 900px) {
    .sidebar { position: static; width: auto; }
    .sidebar nav { display: grid; grid-template-columns: repeat(2, 1fr); }
    .main { margin-left: 0; min-width: 0; padding: 16px; }
    .topbar, .grid.two, .form-grid, .stats-grid, .browse-layout, .home-top { display: block; }
    .panel, .stat { margin-bottom: 12px; }
    .quick-grid, .stat-tiles { grid-template-columns: repeat(2, 1fr); }
    .latest-item { grid-template-columns: 100px 1fr; }
    .latest-thumb { width: 100px; }
    .article-list, .preview-panel { height: auto; min-height: 0; }
    .login-shell { grid-template-columns: 1fr; gap: 18px; }
    .login-hero { padding: 8px 2px 0; }
    .login-box { padding: 24px; border-radius: 20px; }
}

/* Resource and card management: keep dense operational data readable. */
.page-actions, .resource-panel-head, .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.page-actions { margin-bottom: 14px; }
.page-count { font-size: 16px; margin-right: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.resource-filters { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.resource-filters .filter-field { min-width: 150px; gap: 5px; font-size: 12px; }
.resource-filters .filter-search-group { min-width: 250px; flex: 1 1 260px; }
.resource-filters .search-field { min-width: 0; width: 100%; }
.resource-filters .search-field input { width: 100%; }
.filter-pagination { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.filter-pagination a, .filter-pagination .disabled { padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; white-space: nowrap; }
.filter-pagination .disabled { color: #98a2b3; background: #f8fafc; }
.resource-filters .page-size-field { min-width: 120px; }
.resource-filters > button { min-height: 39px; margin-top: 18px; }
.resource-panel { padding: 0; overflow: hidden; }
.resource-panel-head { padding: 18px 20px; border-bottom: 1px solid var(--line); background: #fbfcfe; align-items: flex-start; }
.resource-panel-head h2 { margin: 0 0 5px; font-size: 17px; }
.resource-panel-head .resource-batch { justify-content: flex-end; margin: 0; }
.resource-batch select, .resource-batch input { min-width: 130px; width: auto; }
.table-scroll { overflow-x: auto; }
.resource-table { min-width: 1310px; table-layout: fixed; }
.resource-table th, .resource-table td { padding: 14px 12px; }
.resource-table .col-check { width: 42px; }
.resource-table .col-sequence { width: 58px; }
.resource-table .col-resource { width: 27%; }
.resource-table .col-cover { width: 110px; }
.resource-table .col-access { width: 180px; }
.resource-table .col-source { width: 22%; }
.resource-table .col-status { width: 150px; }
.resource-table .col-actions { width: 106px; }
.resource-table tbody tr:hover { background: #fbfdff; }
.resource-sequence { color: var(--muted); font-weight: 700; text-align: center; }
.resource-title { display: block; line-height: 1.45; font-size: 14px; }
.resource-meta, .metric-line, .time-line { color: var(--muted); font-size: 12px; line-height: 1.65; word-break: break-word; }
.resource-description { margin: 7px 0 4px; color: #475467; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.resource-cover { width: 88px; height: 60px; border-radius: 9px; }
.cover-empty { display: inline-grid; place-items: center; width: 88px; height: 60px; border-radius: 9px; background: #f2f4f7; color: var(--muted); font-size: 12px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; }
.resource-table .tag, .card-section .tag { display: inline-flex; align-items: center; width: fit-content; padding: 3px 7px; border-radius: 999px; background: #e8f0ff; color: #175cd3; font-size: 12px; white-space: nowrap; }
.resource-table .tag.neutral { background: #f2f4f7; color: #667085; }
.resource-table .tag.success, .card-section .tag.success { background: var(--success-bg); color: var(--success-text); }
.resource-table .tag.warn, .card-section .tag.warn { background: #fff4e5; color: #b54708; }
.source-cell { max-width: 260px; }
.source-url { color: #475467; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.resource-actions { flex-direction: column; align-items: stretch; gap: 6px; }
.resource-actions a, .resource-actions button { text-align: center; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0 4px; color: var(--muted); font-size: 13px; }
.pagination a, .pagination .disabled { padding: 7px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.pagination .disabled { color: #98a2b3; background: #f8fafc; }
.card-section { padding: 18px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.card-section.used-section { border-color: #f3d2ce; background: #fffafa; }
.card-section h2 { margin: 0; font-size: 17px; }
.section-heading { margin-bottom: 14px; }
.section-heading .count-badge { padding: 5px 10px; border-radius: 999px; background: #e8f0ff; color: #175cd3; font-size: 12px; }
.used-section .count-badge { background: #fdecec; color: #b42318; }
.card-section table { margin: 0; }
.card-section .table-scroll { border: 1px solid var(--line); border-radius: 8px; }
.card-section.used-section .table-scroll { border-color: #f0d2ce; }
.stats-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stats-summary .stat { padding: 16px; }
.stats-summary .stat strong { font-size: 26px; }
.stats-table td, .stats-table th { padding: 11px 12px; }
.stats-table .selected-row td { background: #f0f6ff; color: #175cd3; font-weight: 700; }
.keyword-list { display: grid; gap: 10px; }
.keyword-item { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; }
.keyword-rank { color: var(--muted); font-weight: 700; }
.keyword-bar { height: 8px; margin-top: 5px; border-radius: 99px; background: #e8f0ff; overflow: hidden; }
.keyword-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1769e0, #73a4ff); }
.stats-date-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.stats-date-form label { min-width: 170px; }
@media (max-width: 900px) {
    .stats-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-actions, .resource-panel-head { display: block; }
    .page-actions .primary { margin-top: 12px; }
    .resource-panel-head .resource-batch { justify-content: flex-start; margin-top: 14px; }
}
