:root {
    --bg: #eef3f8;
    --panel: #ffffff;
    --text: #182233;
    --muted: #657287;
    --line: #dce5ef;
    --accent: #166a6a;
    --accent-dark: #0e4f51;
    --gold: #b7791f;
    --coral: #b44832;
    --blue: #2f5f98;
    --danger: #b42318;
    --warn: #aa5b13;
    --shadow: 0 16px 44px rgba(27, 39, 55, .10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        linear-gradient(180deg, #f8fafc 0, var(--bg) 360px),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 224px;
    background: linear-gradient(180deg, #172033 0%, #1f2a3d 58%, #26333c 100%);
    color: #fff;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand {
    font-size: 24px;
    font-weight: 800;
    padding: 6px 10px 12px;
    letter-spacing: 0;
}

.brand::after {
    content: "信用卡运营";
    display: block;
    color: #9fb0c7;
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.sidebar nav {
    display: grid;
    gap: 13px;
    overflow: auto;
    padding-right: 2px;
}

.nav-group {
    display: grid;
    gap: 4px;
}

.nav-group span {
    padding: 0 10px 3px;
    color: #8ea0ba;
    font-size: 12px;
    font-weight: 700;
}

.sidebar nav a {
    color: #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid transparent;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.10);
    color: #fff;
}

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

.main {
    margin-left: 224px;
    min-height: 100vh;
    padding: 24px 28px 36px;
}

.appbar {
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.86);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.appbar strong {
    display: block;
    font-size: 18px;
}

.eyebrow {
    color: var(--accent);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.appbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.appbar-actions a {
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: #f8fafc;
    padding: 8px 11px;
    font-size: 14px;
}

.appbar-actions a:hover {
    border-color: #9fb8c7;
    color: var(--accent-dark);
}

.account-menu {
    position: relative;
}

.account-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 5px 10px 5px 6px;
}

.account-trigger:hover {
    background: #f8fafc;
    color: var(--text);
}

.account-trigger .avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
}

.account-trigger strong,
.account-trigger em {
    display: block;
    line-height: 1.15;
    text-align: left;
}

.account-trigger strong {
    font-size: 13px;
}

.account-trigger em {
    margin-top: 3px;
    color: var(--muted);
    font-style: normal;
    font-size: 12px;
}

.account-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 40;
    display: none;
    min-width: 150px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(24, 38, 58, .18);
    padding: 6px;
}

.account-menu:hover .account-dropdown,
.account-menu:focus-within .account-dropdown {
    display: grid;
}

.account-dropdown a {
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    padding: 8px 10px;
}

.account-dropdown a:hover {
    background: #f2f6fa;
}

.top {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(130, 148, 170, .25);
    padding-bottom: 14px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); margin-bottom: 4px; }
h2 { font-size: 20px; margin-bottom: 16px; }
h3 { font-size: 16px; margin-bottom: 6px; }

.panel, .stat, .card-tile, .module-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
    margin-bottom: 18px;
}

.panel h2 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.narrow {
    width: min(560px, 100%);
}

.setup {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(340px, .8fr);
    gap: 18px;
    align-items: start;
}

.layout.wide {
    grid-template-columns: minmax(0, 2.6fr) minmax(360px, .9fr);
}

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

.stat {
    min-height: 94px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--accent);
}

.stat:nth-child(2)::before { background: var(--blue); }
.stat:nth-child(3)::before { background: var(--coral); }
.stat:nth-child(4)::before { background: var(--gold); }

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

.module-card {
    min-height: 146px;
    padding: 17px;
    color: var(--text);
    display: grid;
    align-content: start;
    gap: 9px;
    position: relative;
    overflow: hidden;
}

.module-card::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 14px;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    border: 1px solid rgba(22,106,106,.18);
    background: #eef8f6;
}

.module-card:nth-child(2)::after { background: #f5f1e8; border-color: rgba(183,121,31,.20); }
.module-card:nth-child(3)::after { background: #f4eeee; border-color: rgba(180,72,50,.20); }
.module-card:nth-child(4)::after { background: #eef3fb; border-color: rgba(47,95,152,.20); }
.module-card:nth-child(5)::after { background: #f5f7ee; border-color: rgba(93,128,57,.20); }
.module-card:nth-child(6)::after { background: #f4f0f7; border-color: rgba(107,83,148,.20); }

.module-card span {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.module-card strong {
    font-size: 18px;
}

.module-card em {
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
    max-width: calc(100% - 48px);
}

.module-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 42px rgba(27, 39, 55, .14);
}

.process-steps {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.process-steps div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfe;
    min-height: 78px;
}

.process-steps span {
    color: var(--gold);
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
}

.process-steps strong {
    font-size: 14px;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat strong {
    font-size: clamp(22px, 3vw, 29px);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

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

.card-tile {
    padding: 16px;
    display: grid;
    gap: 12px;
    border-left: 5px solid var(--blue);
}

.money-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

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

.bar span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.split > div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    min-height: 76px;
}

.split span,
label span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 5px;
}

.split strong { display: block; }
.split em { color: var(--muted); font-size: 12px; font-style: normal; }

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

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

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

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

textarea {
    min-height: 80px;
    resize: vertical;
}

button {
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    min-height: 40px;
    padding: 8px 14px;
    font: inherit;
    font-weight: 700;
}

button:hover { background: var(--accent-dark); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 8px;
    padding: 0 14px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.button:hover {
    background: var(--accent-dark);
    color: #fff;
}

button.link {
    background: transparent;
    color: var(--accent);
    padding: 0;
    min-height: auto;
}

button.link.danger {
    color: var(--danger);
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    text-align: left;
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
    vertical-align: top;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-weight: 700;
    background: #f8fafc;
    position: sticky;
    top: 0;
}

tbody tr:hover {
    background: #fbfdff;
}

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tabs a {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 8px 12px;
    color: var(--text);
}

.tabs a.active {
    border-color: var(--accent);
    color: var(--accent);
}

.empty {
    border: 1px dashed #b9c6d6;
    border-radius: 8px;
    padding: 26px 18px;
    text-align: center;
    color: var(--muted);
    background: #fbfdff;
}

.alert {
    border-radius: 8px;
    padding: 11px 12px;
    margin-bottom: 14px;
}

.alert.danger {
    color: var(--danger);
    border: 1px solid #fac8c2;
    background: #fff4f3;
}

.small { font-size: 13px; }

.text-danger {
    color: var(--danger);
    font-weight: 700;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.row-actions form {
    margin: 0;
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.table-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.layui-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e6eaf0;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #fbfcff;
    padding: 10px 12px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.button.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    background: #fff;
    color: var(--text);
}

.columns-menu {
    position: relative;
}

.columns-menu summary {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 14px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    list-style: none;
}

.columns-menu summary::-webkit-details-marker {
    display: none;
}

.column-toggle {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    min-width: 190px;
    max-height: 360px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(24, 38, 58, .18);
}

.column-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    border-radius: 6px;
    padding: 7px 9px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.column-toggle label:hover {
    background: #f2f6fa;
}

.column-toggle input {
    width: auto;
}

.dense-table th,
.dense-table td {
    vertical-align: top;
    white-space: nowrap;
}

.layui-table-wrap {
    border: 1px solid #e6eaf0;
    border-radius: 0 0 8px 8px;
}

.layui-like-table {
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

.layui-like-table th {
    border-right: 1px solid #e6eaf0;
    border-bottom: 1px solid #dfe5ed;
    background: #f2f4f8;
    color: #475569;
    padding: 11px 10px;
}

.layui-like-table td {
    border-right: 1px solid #eef2f6;
    border-bottom: 1px solid #eef2f6;
    padding: 10px;
}

.layui-like-table th:last-child,
.layui-like-table td:last-child {
    border-right: 0;
}

.layui-like-table tbody tr[data-edit-url]:hover td {
    background: #f8fbff;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 180px;
}

.card-actions form {
    margin: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    padding: 48px 18px;
    background: rgba(16, 24, 40, .42);
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    width: min(980px, 100%);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .26);
    padding: 18px;
}

.small-modal {
    width: min(620px, 100%);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-head h2 {
    margin: 0;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--line);
    color: var(--text);
    background: #fff;
    font-size: 22px;
    line-height: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.card-manager {
    margin-top: 18px;
}

.card-manager tbody tr[data-edit-url] {
    cursor: pointer;
}

.card-detail-row {
    display: none;
    background: #f8fbff;
}

.card-detail-row.open {
    display: table-row;
}

.card-detail-row td {
    border-top: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 10px;
    padding: 14px 8px;
}

.detail-grid div {
    min-height: 58px;
    border: 1px solid #dfe8ef;
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
}

.detail-grid span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
}

.detail-grid strong {
    color: var(--text);
    font-size: 14px;
    word-break: break-all;
}

.info-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
}

.info-list div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    padding: 12px;
}

.info-list span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
}

.info-list strong {
    color: var(--text);
    font-size: 15px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    color: var(--text);
}

.check input {
    width: auto;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 22px 0;
}

@media (max-width: 1080px) {
    .layout,
    .layout.wide,
    .stats,
    .cards-grid,
    .module-grid,
    .process-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: auto;
    }

    .main {
        margin-left: 0;
        padding: 16px;
    }

    .appbar {
        align-items: start;
        flex-direction: column;
    }

    .appbar-actions,
    .layui-toolbar {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .account-menu,
    .account-trigger,
    .toolbar-left,
    .toolbar-left .button {
        width: 100%;
    }

    .grid.two,
    .filters,
    .detail-grid,
    .split {
        grid-template-columns: 1fr;
    }

    .column-toggle {
        right: auto;
        left: 0;
        min-width: min(320px, calc(100vw - 42px));
        grid-template-columns: 1fr;
    }

    .top {
        align-items: start;
        flex-direction: column;
    }
}
