:root {
    --paper: #f3f6f3;
    --surface: #fff;
    --ink: #16231d;
    --muted: #6a766f;
    --line: #dce4df;
    --line-strong: #c8d4cd;
    --blue: #175cd3;
    --blue-soft: #eef4ff;
    --green: #17855f;
    --green-soft: #e9f6f0;
    --red: #c5413d;
    --red-soft: #fff0ef;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--paper);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
    letter-spacing: 0;
}

button {
    border: 0;
}

a {
    color: inherit;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #fff;
    background: var(--ink);
    border-radius: 8px;
}

.brand-mark svg {
    width: 20px;
    height: 20px;
}

.login-page {
    display: grid;
    place-items: center;
    background:
        linear-gradient(rgba(22, 35, 29, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(22, 35, 29, 0.045) 1px, transparent 1px),
        #edf2ee;
    background-size: 48px 48px;
}

.login-shell {
    width: min(420px, calc(100% - 40px));
    padding: 40px 0;
}

.login-brand,
.admin-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    text-decoration: none;
}

.login-brand {
    margin: 0 0 18px 4px;
}

.login-brand strong,
.login-brand small,
.admin-brand strong,
.admin-brand small {
    display: block;
}

.login-brand strong,
.admin-brand strong {
    font-size: 15px;
    line-height: 1.1;
}

.login-brand small,
.admin-brand small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.login-card {
    padding: 34px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(24, 43, 34, 0.1);
}

.login-heading p,
.eyebrow {
    margin: 0 0 7px;
    color: var(--green);
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 10px;
    font-weight: 700;
}

.login-heading h1 {
    margin: 0 0 28px;
    font-size: 28px;
    line-height: 1.25;
}

.login-card label {
    display: block;
    margin: 16px 0 7px;
    color: #344039;
    font-size: 12px;
    font-weight: 700;
}

.login-field {
    position: relative;
}

.login-field svg {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 17px;
    height: 17px;
    color: #89948e;
    pointer-events: none;
    transform: translateY(-50%);
}

.login-field input {
    width: 100%;
    height: 46px;
    padding: 0 14px 0 42px;
    color: var(--ink);
    outline: none;
    background: #f8faf8;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.login-field input:focus {
    background: #fff;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.11);
}

.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 47px;
    margin-top: 22px;
    color: #fff;
    background: var(--blue);
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    transition: background 160ms ease;
}

.login-button:hover {
    background: #1049a9;
}

.login-button svg {
    width: 17px;
    height: 17px;
}

.alert {
    margin-bottom: 18px;
    padding: 10px 12px;
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid #f3d1cf;
    border-radius: 6px;
    font-size: 12px;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 22px;
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}

.back-link:hover {
    color: var(--blue);
}

.back-link svg {
    width: 15px;
    height: 15px;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    padding: 0 max(24px, calc((100% - 1360px) / 2));
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.topbar-actions form {
    margin: 0;
}

.outline-action,
.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    color: #435149;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 160ms ease, color 160ms ease;
}

.outline-action {
    gap: 7px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
}

.icon-action {
    width: 38px;
}

.outline-action:hover,
.icon-action:hover {
    color: var(--blue);
    border-color: #aabdd8;
}

.outline-action svg,
.icon-action svg {
    width: 16px;
    height: 16px;
}

.admin-main {
    width: min(1360px, calc(100% - 48px));
    margin: 0 auto;
    padding: 46px 0 70px;
}

.admin-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.admin-heading h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1.2;
}

.search-form {
    display: grid;
    grid-template-columns: 18px minmax(180px, 280px) auto;
    align-items: center;
    min-height: 42px;
    padding-left: 13px;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
}

.search-form svg {
    width: 17px;
    height: 17px;
    color: #7d8982;
}

.search-form input {
    min-width: 0;
    height: 40px;
    padding: 0 10px;
    color: var(--ink);
    outline: none;
    background: transparent;
    border: 0;
}

.search-form button {
    align-self: stretch;
    padding: 0 16px;
    color: #fff;
    background: var(--ink);
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 25px;
}

.stat {
    padding: 19px 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.stat strong {
    display: block;
    margin-top: 9px;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 26px;
    line-height: 1;
}

.records-panel {
    margin-top: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.records-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
}

.records-head h2 {
    margin: 0;
    font-size: 14px;
}

.records-head span {
    color: var(--muted);
    font-size: 11px;
}

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

table {
    width: 100%;
    min-width: 1120px;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 13px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #edf1ee;
}

th {
    color: #7a867f;
    background: #f8faf8;
    font-size: 10px;
    font-weight: 700;
}

th:nth-child(1) { width: 66px; }
th:nth-child(2) { width: 230px; }
th:nth-child(3) { width: 310px; }
th:nth-child(4) { width: 104px; }
th:nth-child(5) { width: 64px; }
th:nth-child(6) { width: 82px; }
th:nth-child(7) { width: 142px; }

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #fbfcfb;
}

.cell-id {
    color: #849088;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 11px;
}

.cell-source a,
.cell-api > span {
    display: block;
    overflow: hidden;
    color: #344039;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-source a {
    text-decoration: none;
}

.cell-source a:hover {
    color: var(--blue);
    text-decoration: underline;
}

.cell-api {
    position: relative;
    padding-right: 43px;
}

.cell-api > span {
    color: #476258;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 10px;
}

.copy-mini {
    position: absolute;
    top: 50%;
    right: 12px;
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    color: var(--blue);
    background: var(--blue-soft);
    border-radius: 5px;
    cursor: pointer;
    transform: translateY(-50%);
}

.copy-mini:hover {
    color: #fff;
    background: var(--blue);
}

.copy-mini svg {
    width: 14px;
    height: 14px;
}

.code-pill {
    display: inline-block;
    padding: 5px 8px;
    color: var(--green);
    background: var(--green-soft);
    border-radius: 5px;
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 12px;
    font-weight: 700;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
}

.status i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-ok {
    color: var(--green);
}

.status-error {
    color: var(--red);
}

.cell-time span,
.cell-time small {
    display: block;
    white-space: nowrap;
}

.cell-time span {
    font-family: "Consolas", "SFMono-Regular", monospace;
    font-size: 10px;
}

.cell-time small {
    margin-top: 4px;
    color: #8b958f;
    font-size: 9px;
}

.empty-state {
    display: grid;
    min-height: 280px;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: #8a958f;
}

.empty-state svg {
    width: 30px;
    height: 30px;
}

.empty-state p {
    margin: 0;
    font-size: 12px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    min-height: 60px;
    border-top: 1px solid var(--line);
    font-size: 11px;
}

.pagination a,
.pagination > span {
    min-width: 62px;
    padding: 7px 10px;
    text-align: center;
    text-decoration: none;
}

.pagination a {
    color: var(--blue);
    background: var(--blue-soft);
    border-radius: 5px;
}

.pagination .is-disabled {
    color: #a8b1ac;
}

.page-number {
    color: var(--muted);
    font-family: "Consolas", "SFMono-Regular", monospace;
}

.toast {
    position: fixed;
    z-index: 20;
    right: 24px;
    bottom: 24px;
    max-width: min(340px, calc(100% - 48px));
    padding: 11px 15px;
    color: #fff;
    background: #1d2b24;
    border-radius: 7px;
    box-shadow: 0 12px 36px rgba(16, 32, 23, 0.2);
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 820px) {
    .admin-zero {
        display: none;
    }

    .admin-main {
        width: calc(100% - 28px);
        padding-top: 32px;
    }

    .admin-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form {
        grid-template-columns: 18px minmax(0, 1fr) auto;
        width: 100%;
    }

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

@media (max-width: 560px) {
    .admin-topbar {
        height: 68px;
        padding: 0 14px;
    }

    .admin-brand small {
        display: none;
    }

    .outline-action {
        width: 38px;
        padding: 0;
    }

    .outline-action svg {
        transform: rotate(180deg);
    }

    .outline-action {
        font-size: 0;
    }

    .admin-heading h1 {
        font-size: 28px;
    }

    .stat {
        padding: 16px;
    }

    .stat strong {
        font-size: 23px;
    }

    .records-head {
        padding: 0 16px;
    }

    .login-card {
        padding: 26px 22px;
    }
}
