:root {
    --forest-950: #102f27;
    --forest-900: #173e34;
    --forest-800: #205244;
    --forest-700: #2c6857;
    --forest-100: #dcebe5;
    --cream: #f6f1e7;
    --cream-2: #fbf8f1;
    --paper: #ffffff;
    --ink: #1f2c28;
    --muted: #6f7d77;
    --line: #e4e5df;
    --orange: #e7783b;
    --orange-dark: #c95920;
    --gold: #d8a443;
    --red: #b7473a;
    --shadow: 0 18px 50px rgba(26, 55, 46, 0.10);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--cream);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 80% 0, rgba(216, 164, 67, 0.10), transparent 28rem),
        var(--cream);
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 20px 22px;
    display: flex;
    flex-direction: column;
    color: #fff;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.05), transparent 50%),
        var(--forest-950);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 28px;
}

.brand-mark,
.auth-brand {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    color: var(--forest-950);
    background: var(--cream);
    font-family: Georgia, serif;
    font-weight: 700;
    font-size: 23px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 18px;
    letter-spacing: 0.08em;
}

.brand small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 12px;
    letter-spacing: 0.12em;
}

.main-nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    width: 100%;
    padding: 13px 14px;
    display: flex;
    gap: 13px;
    align-items: center;
    border: 0;
    border-radius: 13px;
    color: rgba(255, 255, 255, 0.72);
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: 160ms ease;
}

.nav-item span {
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    letter-spacing: 0.08em;
}

.nav-item:hover,
.nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
}

.nav-item.active span {
    color: #f0ba65;
}

.sidebar-note {
    margin-top: auto;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-note strong {
    font-size: 13px;
}

.sidebar-note p {
    margin: 7px 0 0;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    line-height: 1.6;
}

.logout-button {
    width: 100%;
    margin-top: 12px;
    padding: 11px;
    border: 0;
    color: rgba(255, 255, 255, 0.52);
    background: transparent;
    cursor: pointer;
}

.logout-button:hover {
    color: #fff;
}

.main-content {
    width: 100%;
    max-width: 1540px;
    padding: 34px clamp(22px, 4vw, 62px) 60px;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--orange-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-family: Georgia, "Songti SC", serif;
    font-size: clamp(27px, 3vw, 42px);
    font-weight: 600;
    letter-spacing: -0.03em;
}

h2 {
    margin: 0;
    font-size: 22px;
}

h3 {
    margin: 0;
    font-size: 16px;
}

.topbar-actions,
.card-actions,
.filter-actions,
.stage-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.button {
    min-height: 42px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    color: #fff;
    background: var(--forest-800);
    box-shadow: 0 10px 24px rgba(32, 82, 68, 0.18);
}

.button.primary:hover {
    background: var(--forest-900);
}

.button.secondary {
    color: var(--forest-800);
    border-color: #d8ddd8;
    background: rgba(255, 255, 255, 0.62);
}

.button.orange {
    color: #fff;
    background: var(--orange);
}

.button.ghost {
    min-height: 34px;
    padding: 7px 10px;
    color: var(--forest-800);
    border-color: #dfe5e1;
    background: #fff;
    font-size: 12px;
}

.button.danger {
    color: var(--red);
    border-color: #efd8d4;
    background: #fff8f7;
}

.button.block {
    width: 100%;
}

.button[disabled] {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

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

.metric-card {
    min-height: 120px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(31, 44, 40, 0.06);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
}

.metric-card::after {
    content: "";
    position: absolute;
    width: 70px;
    height: 70px;
    right: -25px;
    bottom: -25px;
    border-radius: 50%;
    background: var(--metric-color, var(--forest-100));
    opacity: 0.65;
}

.metric-card span {
    color: var(--muted);
    font-size: 13px;
}

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-family: Georgia, serif;
    font-size: 32px;
    line-height: 1;
}

.metric-card small {
    display: block;
    margin-top: 9px;
    color: #95a09b;
    font-size: 11px;
}

.panel {
    padding: 22px;
    border: 1px solid rgba(31, 44, 40, 0.07);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
}

.panel + .panel {
    margin-top: 18px;
}

.panel-header {
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.panel-header p,
.section-copy {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.account-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 13px;
}

.progress-card {
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--cream-2);
}

.progress-head,
.progress-meta,
.lead-head,
.content-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.platform-badge,
.stage-badge,
.status-badge {
    padding: 5px 9px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 11px;
    white-space: nowrap;
}

.platform-badge {
    color: var(--forest-800);
    background: var(--forest-100);
}

.progress-number {
    margin-top: 15px;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.progress-number strong {
    font-family: Georgia, serif;
    font-size: 27px;
}

.progress-number span {
    color: var(--muted);
    font-size: 13px;
}

.progress-track {
    height: 7px;
    margin: 9px 0 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6e7e1;
}

.progress-track i {
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--forest-700), var(--gold));
}

.progress-meta {
    align-items: center;
}

.progress-meta small {
    color: var(--muted);
}

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(310px, 0.8fr);
    gap: 18px;
}

.lead-list {
    display: grid;
    gap: 12px;
}

.lead-card {
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fff;
}

.lead-title {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.lead-title h3 {
    font-size: 16px;
}

.lead-subtitle {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.stage-badge.new {
    color: #9a4b20;
    background: #fff0e6;
}

.stage-badge.messaged {
    color: #31617c;
    background: #e7f1f7;
}

.stage-badge.wechat,
.stage-badge.trial {
    color: #245d4e;
    background: #e2f1eb;
}

.stage-badge.won {
    color: #7f5b0f;
    background: #f8ebc8;
}

.stage-badge.lost {
    color: #737b78;
    background: #eceeec;
}

.comment-box,
.message-box,
.notes-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.65;
}

.comment-box {
    color: #46544f;
    background: #f5f6f3;
}

.message-box {
    position: relative;
    padding-right: 72px;
    color: #275346;
    background: #eef6f1;
}

.message-box .copy-mini {
    position: absolute;
    top: 9px;
    right: 9px;
}

.notes-box {
    color: #705b38;
    background: #fff8e9;
}

.lead-footer {
    margin-top: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lead-footer small {
    color: var(--muted);
}

.empty-state {
    min-height: 180px;
    padding: 34px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    border: 1px dashed #cfd7d2;
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.45);
}

.empty-state b {
    font-size: 17px;
}

.empty-state p {
    max-width: 420px;
    margin: 8px 0 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

.filter-bar {
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 170px 170px auto;
    gap: 10px;
}

label {
    display: grid;
    gap: 7px;
    color: #45534e;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid #d8ddd9;
    border-radius: 11px;
    color: var(--ink);
    background: #fff;
    outline: none;
    transition: border 120ms ease, box-shadow 120ms ease;
}

textarea {
    min-height: 90px;
    resize: vertical;
    line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--forest-700);
    box-shadow: 0 0 0 3px rgba(44, 104, 87, 0.11);
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
    gap: 14px;
}

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

.account-card.inactive {
    opacity: 0.66;
}

.account-card .account-name {
    margin: 11px 0 6px;
    font-size: 19px;
}

.account-card p {
    min-height: 42px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.account-stats {
    margin: 16px 0;
    padding: 12px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.account-stats span {
    color: var(--muted);
    font-size: 12px;
}

.account-stats strong {
    margin-top: 4px;
    display: block;
    font-size: 18px;
}

.content-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
}

.content-column {
    min-height: 280px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #f8f8f4;
}

.content-column > h3 {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-column > h3 span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--muted);
    background: #e9ebe7;
    font-size: 11px;
}

.content-stack {
    display: grid;
    gap: 10px;
}

.content-card {
    padding: 14px;
    border: 1px solid #e2e4df;
    border-radius: 14px;
    background: #fff;
}

.content-card h4 {
    margin: 10px 0 8px;
    font-size: 14px;
    line-height: 1.55;
}

.content-card p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 12px;
}

.status-badge {
    color: #76561b;
    background: #f8eecd;
}

.content-card.published {
    border-color: #d4e6de;
}

.content-card.skipped {
    opacity: 0.62;
}

.loading-card {
    min-height: 250px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.modal-backdrop {
    position: fixed;
    z-index: 20;
    inset: 0;
    padding: 24px;
    display: grid;
    place-items: center;
    background: rgba(12, 35, 29, 0.58);
    backdrop-filter: blur(7px);
}

.modal {
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 24px;
    border-radius: 24px;
    background: var(--cream-2);
    box-shadow: 0 30px 80px rgba(12, 35, 29, 0.30);
}

.modal-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    background: #fff;
    font-size: 24px;
    cursor: pointer;
}

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

.form-grid .full {
    grid-column: 1 / -1;
}

.form-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.helper-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.helper-text {
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
}

.toast {
    position: fixed;
    z-index: 30;
    left: 50%;
    bottom: 28px;
    padding: 12px 18px;
    transform: translateX(-50%);
    border-radius: 12px;
    color: #fff;
    background: var(--forest-950);
    box-shadow: var(--shadow);
    font-size: 13px;
}

.toast.error {
    background: var(--red);
}

.hidden {
    display: none !important;
}

.notice {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 11px;
    font-size: 13px;
    line-height: 1.6;
}

.notice.error {
    color: #8b342a;
    background: #fce8e5;
}

.notice.success {
    color: #1e5a49;
    background: #e4f2ec;
}

.auth-body {
    padding: 34px 18px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 10% 0, rgba(216, 164, 67, 0.18), transparent 30rem),
        linear-gradient(150deg, var(--forest-950), var(--forest-800));
}

.auth-card {
    width: min(430px, 100%);
    padding: 34px;
    border-radius: 26px;
    background: var(--cream-2);
    box-shadow: 0 30px 90px rgba(6, 24, 19, 0.38);
}

.auth-card.setup-card {
    width: min(690px, 100%);
}

.auth-card .auth-brand {
    color: #fff;
    background: var(--forest-800);
}

.auth-card h1 {
    margin-top: 22px;
    font-size: 30px;
}

.auth-card > p {
    margin: 9px 0 22px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.auth-card form {
    display: grid;
    gap: 15px;
}

@media (max-width: 1100px) {
    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .split-grid,
    .content-board {
        grid-template-columns: 1fr;
    }

    .content-column {
        min-height: 0;
    }
}

@media (max-width: 780px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 15px 14px 12px;
        display: block;
    }

    .brand {
        padding: 0 2px 13px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        font-size: 20px;
    }

    .main-nav {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .nav-item {
        padding: 9px 5px;
        display: grid;
        justify-items: center;
        gap: 3px;
        font-size: 12px;
        text-align: center;
    }

    .nav-item span {
        font-size: 9px;
    }

    .sidebar-note,
    .logout-button {
        display: none;
    }

    .main-content {
        padding: 22px 15px 38px;
    }

    .topbar {
        display: block;
    }

    .topbar-actions {
        margin-top: 17px;
    }

    .topbar-actions .button {
        flex: 1;
    }

    .metric-grid {
        margin: 20px 0;
        gap: 9px;
    }

    .metric-card {
        min-height: 105px;
        padding: 16px;
    }

    .metric-card strong {
        font-size: 27px;
    }

    .panel {
        padding: 16px;
        border-radius: 18px;
    }

    .filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .filter-bar .search-field {
        grid-column: 1 / -1;
    }

    .filter-actions {
        grid-column: 1 / -1;
    }

    .modal-backdrop {
        padding: 0;
        align-items: end;
    }

    .modal {
        width: 100%;
        max-height: 94vh;
        padding: 21px 16px 28px;
        border-radius: 24px 24px 0 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .full {
        grid-column: auto;
    }
}

@media (max-width: 430px) {
    .metric-grid {
        grid-template-columns: 1fr 1fr;
    }

    .account-progress-grid,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .lead-footer {
        align-items: stretch;
    }

    .lead-footer .stage-actions,
    .lead-footer .button {
        width: 100%;
    }

    .stage-actions .button {
        flex: 1;
    }

    .auth-card {
        padding: 28px 22px;
    }
}
