:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --text: #182230;
    --muted: #667085;
    --line: #d9e2ec;
    --primary: #07c160;
    --primary-dark: #05a850;
    --accent: #2f6fed;
    --warning: #b7791f;
    --danger: #d92d20;
    --success: #11845b;
    --shadow: 0 18px 50px rgba(24, 34, 48, .12);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(15, 159, 110, .10), transparent 34%),
        linear-gradient(225deg, rgba(47, 111, 237, .12), transparent 30%),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.public-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    padding: 28px 16px;
}

.public-card {
    width: min(560px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--panel);
    border: 1px solid rgba(217, 226, 236, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.brand-pane {
    min-height: auto;
    padding: 34px 34px 28px;
    background: #07c160;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.brand-pane::after {
    content: "";
    position: absolute;
    left: -8%;
    right: -8%;
    bottom: -34px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,.16);
}

.brand-pane h1 {
    margin: 0 0 12px;
    font-size: clamp(28px, 5vw, 36px);
    line-height: 1.2;
    letter-spacing: 0;
    position: relative;
    z-index: 1;
}

.brand-pane p {
    margin: 0;
    color: rgba(255,255,255,.74);
    font-size: 16px;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.feature-list {
    display: grid;
    gap: 12px;
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.feature-line {
    display: flex;
    gap: 10px;
    align-items: center;
    color: rgba(255,255,255,.82);
}

.feature-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    flex: 0 0 auto;
}

.form-pane {
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.page-title {
    margin-bottom: 28px;
}

.page-title h2 {
    margin: 0 0 8px;
    font-size: 28px;
    letter-spacing: 0;
}

.page-title p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.form-grid {
    display: grid;
    gap: 18px;
}

.field label {
    display: block;
    margin-bottom: 8px;
    color: #344054;
    font-size: 14px;
    font-weight: 700;
}

.input,
.select,
.textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 13px 14px;
    font-size: 15px;
    outline: none;
    background: #fff;
    color: var(--text);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.textarea {
    min-height: 92px;
    resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 159, 110, .14);
}

.button {
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    padding: 13px 16px;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
    position: relative;
    overflow: hidden;
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 159, 110, .18);
}

.button.loading {
    pointer-events: none;
    opacity: .92;
}

.button.loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.55);
    border-top-color: #fff;
    animation: spin .75s linear infinite;
}

.button.secondary {
    background: #edf2f7;
    color: #263445;
}

.button.secondary:hover {
    background: #e2e8f0;
    box-shadow: none;
}

.button.danger {
    background: var(--danger);
}

.button.warning {
    background: var(--warning);
}

.link-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
    color: var(--muted);
    font-size: 14px;
}

.link-row a {
    color: var(--accent);
    font-weight: 700;
}

.result-box,
.notice,
.flash {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    padding: 16px;
    background: var(--panel-2);
}

.result-box {
    margin-top: 22px;
}

.result-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    background: #eef2f6;
    color: var(--muted);
}

.badge.success { background: #dcfce7; color: var(--success); }
.badge.danger { background: #fee4e2; color: var(--danger); }
.badge.warning { background: #fef3c7; color: var(--warning); }
.badge.muted { background: #edf2f7; color: #475467; }

.detail-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.detail-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.detail-row strong {
    color: var(--text);
    word-break: break-all;
}

.flash {
    margin-bottom: 16px;
}

.flash.success { border-color: rgba(17,132,91,.25); background: #ecfdf3; color: var(--success); }
.flash.error { border-color: rgba(217,45,32,.25); background: #fff1f3; color: var(--danger); }
.flash.info { border-color: rgba(47,111,237,.25); background: #eef4ff; color: var(--accent); }

.progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24, 34, 48, .72);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 80;
}

.progress-overlay.active {
    display: flex;
}

.public-card,
.login-card,
.card,
.result-box {
    animation: softIn .28s ease both;
}

.progress-panel {
    width: min(460px, 100%);
    background: #fff;
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
}

.progress-title {
    margin: 0 0 18px;
    font-size: 20px;
}

.progress-steps {
    display: grid;
    gap: 10px;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.step-index {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e7eef6;
    color: #344054;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
}

.progress-step.active .step-index {
    background: var(--primary);
    color: #fff;
}

.progress-step.active {
    color: var(--text);
    font-weight: 800;
}

.public-footer {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.auth-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.login-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 32px;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

.login-card p {
    margin: 0 0 24px;
    color: var(--muted);
}

.panel-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    background: var(--bg);
}

.sidebar {
    background: #182230;
    color: #fff;
    padding: 22px 16px;
    min-height: 100vh;
    position: sticky;
    top: 0;
}

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

.sidebar-brand b {
    display: block;
}

.sidebar-brand span {
    color: rgba(255,255,255,.62);
    font-size: 13px;
}

.nav-group {
    margin-top: 18px;
}

.nav-title {
    padding: 0 10px 8px;
    color: rgba(255,255,255,.48);
    font-size: 12px;
    font-weight: 800;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 10px;
    border-radius: var(--radius);
    color: rgba(255,255,255,.78);
    margin-bottom: 4px;
}

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

.main {
    min-width: 0;
    padding: 26px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0;
    font-size: 28px;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.user-pill {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e6f6ef;
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: 900;
    flex: 0 0 auto;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid {
    display: grid;
    gap: 16px;
}

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

.grid.two {
    grid-template-columns: 1.1fr .9fr;
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 8px 24px rgba(24,34,48,.05);
}

.stat-value {
    font-size: 30px;
    font-weight: 900;
    margin: 8px 0 2px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.card-title {
    margin: 0 0 16px;
    font-size: 18px;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.table th,
.table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

.table th {
    color: #475467;
    background: #f8fafc;
    font-size: 13px;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar .input,
.toolbar .select {
    width: auto;
    min-width: 180px;
}

.inline-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.key-text {
    font-family: Consolas, Monaco, "Courier New", monospace;
    word-break: break-all;
}

.empty {
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

.generated-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.generated-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pagination a,
.pagination span {
    padding: 8px 11px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius);
}

.pagination .active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

@media (max-width: 900px) {
    .grid.two,
    .grid.stats,
    .panel-body {
        grid-template-columns: 1fr;
    }

    .brand-pane {
        padding: 30px;
    }

    .form-pane {
        padding: 30px;
    }

    .sidebar {
        position: static;
        min-height: auto;
    }

    .main {
        padding: 18px;
    }

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

@keyframes softIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
    .brand-pane,
    .form-pane,
    .login-card {
        padding: 22px;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .toolbar .input,
    .toolbar .select {
        width: 100%;
    }
}
