:root {
    --bg: #f3f5f7;
    --card: #ffffff;
    --text: #1d2430;
    --muted: #5d6b7a;
    --line: #d7dee6;
    --accent: #1b5f86;
    --accent-hover: #144a69;
    --row-hover: #f6f9fb;
    --never: #8a5a12;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

html {
    scroll-behavior: smooth;
}

code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92em;
}

a {
    color: var(--accent);
}

.topbar {
    background: #14202c;
    color: #fff;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.topbar-inner nav {
    flex: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c5d0db;
    font-size: 13px;
}

.topbar-user a {
    color: #fff;
    text-decoration: none;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.topbar nav a {
    color: #c5d0db;
    text-decoration: none;
    margin-right: 16px;
}

.topbar nav a.is-active,
.topbar nav a:hover {
    color: #fff;
}

.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.page-head h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
}

.lede {
    margin: 0 0 18px;
    color: var(--muted);
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.filters label span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
}

.filters input,
.filters select {
    width: 100%;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0 8px;
    font: inherit;
    background: #fff;
}

.filters input[type="checkbox"] {
    width: auto;
    height: auto;
}

.filter-check {
    height: 34px;
    margin: 0;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1;
}

a.btn:link,
a.btn:visited {
    color: var(--text);
    text-decoration: none;
}

.btn:hover {
    background: #f2f5f8;
}

.btn-primary,
a.btn-primary:link,
a.btn-primary:visited {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: 13px;
}

.table-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.table-meta {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.data-table th {
    font-size: 12px;
    font-weight: 650;
    color: var(--muted);
    background: #f8fafb;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: var(--row-hover);
}

.data-table .num {
    font-variant-numeric: tabular-nums;
    font-family: Consolas, "Courier New", monospace;
    white-space: nowrap;
}

.data-table .url a {
    word-break: break-all;
}

.data-table .never {
    color: var(--never);
    font-style: italic;
}

.data-table .job-title {
    min-width: 180px;
    max-width: 280px;
}

.meta-cell {
    min-width: 320px;
}

.meta-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 14px;
    margin: 0;
    font-size: 12px;
}

.meta-list div {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px;
    min-width: 0;
}

.meta-list dt {
    color: var(--muted);
    font-weight: 650;
    white-space: nowrap;
}

.meta-list dt::after {
    content: ":";
}

.meta-list dd {
    margin: 0;
    min-width: 0;
    word-break: break-word;
}

.meta-list dd a {
    word-break: break-all;
}

body.modal-open {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 16px;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 32, 44, 0.55);
}

.modal-dialog {
    position: relative;
    z-index: 1;
    width: min(860px, 100%);
    max-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 12px 40px rgba(20, 32, 44, 0.25);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.modal-head h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.modal-head .muted {
    margin: 0;
}

.modal-body {
    overflow: auto;
    padding: 18px;
}

.job-description {
    line-height: 1.55;
}

.job-description img,
.job-description table {
    max-width: 100%;
}

.modal-dialog-wide {
    width: min(960px, 100%);
}

.crawl-log {
    margin: 0;
    padding: 12px 14px;
    background: #14202c;
    color: #e8eef4;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 160px;
    max-height: calc(100vh - 240px);
    overflow: auto;
}

.data-table td.actions {
    white-space: nowrap;
    width: 1%;
}

.muted {
    color: var(--muted);
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 10px 14px;
}

.pager button {
    min-width: 34px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font: inherit;
}

.pager button.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pager button:disabled {
    opacity: 0.45;
    cursor: default;
}

.noscript {
    padding: 16px 20px;
    color: #8a1f1f;
}

.alert {
    padding: 10px 12px;
    border-radius: 5px;
    margin-bottom: 14px;
}

.alert-error {
    background: #fdecea;
    color: #8a1f1f;
}

.alert-success {
    background: #e7f6ec;
    color: #1e6b3a;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.badge-on {
    background: #e7f6ec;
    color: #1e6b3a;
}

.badge-off {
    background: #f3f5f7;
    color: #5d6b7a;
}

.badge-error {
    background: #fdecea;
    color: #8a1f1f;
}

.form-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.form-card h2 {
    margin: 0 0 12px;
    font-size: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
}

.form-card label span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
}

.form-card input[type="text"],
.form-card input[type="password"] {
    width: 100%;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0 8px;
    font: inherit;
    background: #fff;
}

.form-card input[type="file"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 4px 8px;
    font: inherit;
    background: #fff;
}

.import-card {
    margin-top: 16px;
    scroll-margin-top: 24px;
}

.import-card .lede {
    margin-bottom: 12px;
}

.import-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: end;
}

.import-errors {
    margin: 10px 0 0;
    padding-left: 18px;
    color: #8a1f1f;
}

.import-errors[hidden] {
    display: none;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 34px;
}

.check-label span {
    margin: 0 !important;
    color: var(--text) !important;
    font-size: 14px !important;
}

.form-msg {
    min-height: 1.2em;
    margin: 10px 0 0;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px 24px;
}

.login-card h1 {
    margin: 0 0 6px;
    font-size: 22px;
}

.login-card label {
    display: block;
    margin-bottom: 12px;
}

.login-card label span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
}

.login-card input {
    width: 100%;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 0 8px;
    font: inherit;
}

.btn-block {
    width: 100%;
    margin-top: 8px;
}

@media (max-width: 960px) {
    .filters {
        grid-template-columns: 1fr 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .import-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .filters {
        grid-template-columns: 1fr;
    }
}
