:root {
    color-scheme: light;
    --ink: #15283c;
    --muted: #6c7e90;
    --line: #e2e9f0;
    --blue: #255fdd;
    --navy: #132c46;
    --bg: #f3f6fa;
    --green: #167a61
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: var(--bg)
}

[hidden] {
    display: none !important
}

button, input {
    font: inherit
}

button {
    cursor: pointer;
    border: 0;
    border-radius: 9px;
    padding: 10px 18px;
    font-weight: 600;
    transition: background .15s, box-shadow .15s
}

button:disabled {
    opacity: .5;
    cursor: not-allowed
}

button:focus-visible, input:focus-visible {
    outline: 3px solid #84b0ff;
    outline-offset: 3px
}

input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ccd7e3;
    border-radius: 8px;
    color: var(--ink);
    background: #fff
}

label {
    display: block;
    margin: 18px 0 7px;
    font-weight: 600
}

.primary {
    background: var(--blue);
    color: #fff
}

.primary:hover {
    background: #174fcb
}

.secondary {
    background: #fff;
    color: #34516d;
    border: 1px solid var(--line)
}

.secondary:hover {
    background: #edf3fb
}

.wide {
    width: 100%
}

.muted {
    color: var(--muted)
}

.small {
    font-size: 12px
}

.eyebrow {
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 700;
    color: #688aaf
}

h1, h2, h3, p {
    margin-top: 0
}

h2 {
    font-size: 24px;
    line-height: 1.3
}

h3 {
    font-size: 16px
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 17px
}

.brand-icon {
    background: var(--blue);
    border-radius: 10px;
    color: #fff;
    padding: 6px 9px;
    font-size: 16px;
    letter-spacing: -1px
}

.login-layout {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #f7f8fa
}

.intro .brand {
    margin-bottom: 70px
}

.intro h1 {
    font-size: clamp(36px, 4vw, 58px);
    line-height: 1.3;
    letter-spacing: -1px
}

.intro-copy {
    max-width: 470px;
    color: #60748b;
    font-size: 16px
}

.intro-grid {
    display: flex;
    gap: 38px;
    margin-top: 35px
}

.intro-grid strong, .intro-grid span {
    display: block
}

.intro-grid span {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px
}

.login-card {
    display: grid;
    gap: 18px;
    background: #fff;
    padding: 32px;
    border: 1px solid #e9edf2;
    border-radius: 14px;
    box-shadow: 0 8px 30px #15283c06;
    max-width: 360px;
    width: 100%
}

.login-card input, .login-card button {
    min-height: 48px
}

.login-card input[aria-invalid="true"] {
    border-color: #c53045
}

.error {
    color: #c53045;
    min-height: 28px;
    font-size: 13px;
    margin-top: 12px
}

.loading {
    display: grid;
    place-items: center;
    min-height: 100vh;
    color: var(--muted)
}

.workspace {
    display: grid;
    grid-template-columns:246px 1fr;
    min-height: 100vh
}

.sidebar {
    background: var(--navy);
    color: #fff;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh
}

.sidebar .brand {
    padding: 0 10px
}

.identity {
    margin: 40px 10px 28px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    overflow-wrap: anywhere
}

.tag {
    border-radius: 5px;
    background: #ffffff18;
    padding: 3px 9px;
    font-size: 11px;
    color: #bfd4f0
}

.nav-item {
    display: block;
    width: 100%;
    text-align: left;
    color: #b8c9dc;
    background: transparent;
    margin: 6px 0;
    font-size: 14px
}

.nav-item.active {
    background: #315575;
    color: white
}

.nav-item:hover {
    background: #ffffff12
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 50px
}

.sidebar-bottom .muted {
    color: #8ea7c0
}

.sidebar-bottom .secondary {
    background: #ffffff0b;
    color: #cad9e9;
    border-color: #ffffff20
}

.content {
    padding: 40px clamp(20px, 4vw, 65px);
    max-width: 1550px;
    width: 100%
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 15px
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0
}

.topbar h1 {
    font-size: 28px;
    line-height: 1.3;
    margin: 0
}

.topbar .eyebrow {
    margin-bottom: 8px
}

.metrics {
    display: grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap: 22px;
    margin: 28px 0
}

.metric {
    padding: 27px 25px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    box-shadow: 0 3px 7px #102c4503
}

.metric p {
    color: #6b8096;
    font-size: 13px
}

.metric strong {
    font-size: clamp(22px, 2.3vw, 34px);
    font-weight: 650;
    display: block;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
    line-height: 1.3
}

.metric span {
    font-size: 12px;
    color: #8998a8;
    display: block;
    margin-top: 18px
}

.metric.accent {
    background: linear-gradient(130deg, #255fdd, #1c47a2);
    color: white;
    border: 0;
}

.metric.accent p, .metric.accent span {
    color: #d7e5ff
}

.info-card {
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 25px;
    background: #fff;
    margin-top: 30px
}

.info-card p {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px
}

.section-heading {
    margin-bottom: 20px
}

.section-heading h2 {
    font-size: 20px;
    margin-bottom: 8px
}

.section-heading p {
    font-size: 13px
}

.table-wrap {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    overflow-x: auto
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 14px;
    white-space: nowrap
}

th, td {
    padding: 16px 22px;
    text-align: left;
    border-bottom: 1px solid var(--line)
}

th {
    background: #f8fafc;
    color: #77899b;
    font-size: 12px;
    font-weight: 500
}

tr:last-child td {
    border-bottom: 0
}

.payment-remark {
    min-width: 160px;
    max-width: 360px;
    white-space: pre-wrap;
    overflow-wrap: anywhere
}

.empty {
    padding: 50px;
    text-align: center;
    color: var(--muted);
    background: white;
    border-radius: 12px
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin: 20px 0;
    color: var(--muted);
    font-size: 13px
}

.advert-list {
    display: grid;
    gap: 18px
}

.advert-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    padding: 24px
}

.bulk-state-card {
    margin-top: 20px
}

.bulk-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 18px 0
}

#advert-bulk-result {
    white-space: pre-wrap;
    color: var(--ink)
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%)
}

.advert-head {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: center
}

.advert-head h3 {
    margin: 0;
    overflow-wrap: anywhere
}

.badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 5px;
    background: #edf2f7;
    color: #60748a;
    white-space: nowrap
}

.badge.valid {
    background: #e5f6ef;
    color: #157355
}

.badge.invalid, .badge.lock {
    background: #fff2df;
    color: #945f17
}

.link-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px
}

.link-form input {
    flex: 1;
    min-width: 0;
    font-size: 13px
}

.advert-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 18px
}

.advert-actions p {
    font-size: 12px;
    color: var(--muted);
    margin: 0
}

.stop {
    color: #b84646
}

.start {
    color: var(--green)
}

#notice {
    position: fixed;
    right: 24px;
    top: 24px;
    z-index: 99;
    max-width: min(500px, 90vw);
    padding: 15px 22px;
    border-radius: 10px;
    background: #173551;
    color: #fff;
    box-shadow: 0 10px 35px #112b4930;
    font-size: 14px
}

#notice.error-notice {
    background: #983943
}

@media (max-width: 1000px) {
    .workspace {
        grid-template-columns:205px 1fr
    }

    .content {
        padding: 30px 22px
    }

    .metrics {
        gap: 12px
    }

    .metric {
        padding: 22px 16px
    }
}

@media (max-width: 720px) {
    .login-layout {
        padding: 20px
    }

    .intro .brand {
        margin-bottom: 32px
    }

    .intro h1 {
        font-size: 34px
    }

    .intro-copy, .intro-grid {
        display: none
    }

    .login-card {
        padding: 24px
    }

    .workspace {
        display: block
    }

    .sidebar {
        min-height: auto;
        padding: 18px 20px
    }

    .sidebar .brand {
        padding: 0
    }

    .identity {
        flex-direction: row;
        align-items: center;
        margin: 18px 0 10px;
        gap: 12px
    }

    .sidebar nav {
        display: flex;
        flex-wrap: wrap;
        gap: 4px
    }

    .nav-item {
        width: auto;
        font-size: 12px;
        padding: 8px 10px
    }

    .sidebar-bottom {
        margin-top: 8px;
        padding-top: 0
    }

    .sidebar-bottom p {
        display: none
    }

    .sidebar-bottom button {
        width: auto;
        font-size: 12px;
        padding: 6px 10px
    }

    .content {
        padding: 26px 18px
    }

    .topbar h1 {
        font-size: 24px
    }

    .metrics {
        grid-template-columns:1fr
    }

    .metric {
        padding: 20px 24px
    }

    .metric strong {
        font-size: 30px
    }

    .metric span {
        margin-top: 9px
    }

    .metric p {
        margin-bottom: 8px
    }

    .link-form {
        flex-wrap: wrap
    }

    .link-form input {
        flex-basis: 100%
    }

    .advert-head {
        align-items: flex-start
    }

    .advert-actions {
        align-items: flex-start
    }

    .pagination {
        justify-content: center
    }

    .topbar {
        margin-bottom: 22px;
        align-items: flex-start
    }

    .topbar-actions {
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 8px
    }
}
