:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --text: #182230;
    --muted: #667085;
    --line: #d9e2ec;
    --primary: #ff2442;
    --primary-dark: #d91f3a;
    --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: var(--bg);
}

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

.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.title-icon {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.title-with-icon,
.topbar-title,
.mobile-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

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

.public-card {
    width: min(560px, 100%);
    margin: 0 auto;
    justify-self: center;
    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: 30px 34px 56px;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.brand-pane::before {
    content: "";
    position: absolute;
    left: -8%;
    right: -8%;
    bottom: 20px;
    height: 64px;
    border-radius: 50%;
    display: none;
}

.brand-pane::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    pointer-events: none;
}

.brand-pane h1 {
    margin: 0;
    font-size: clamp(22px, 4vw, 28px);
    line-height: 1.2;
    letter-spacing: 0;
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
}

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

.brand-subtitle {
    margin: -4px 0 12px;
    color: rgba(255,255,255,.92);
    font-size: 15px;
    font-weight: 700;
}

.brand-icon {
    width: 84px;
    height: 54px;
    margin: 0 auto 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    position: relative;
    z-index: 1;
}

.brand-wechat-icon {
    width: 48px;
    height: 48px;
    stroke-width: 1.8;
}

.brand-icon img {
    width: 48px;
    height: 48px;
    display: block;
    filter: brightness(0) invert(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: 34px 32px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

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

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

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

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

.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 .icon {
    width: 17px;
    height: 17px;
}

.button.compact {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 13px;
}

.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);
}

.check-line {
    color: var(--text);
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 12px;
}

.public-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.public-action-row.single {
    grid-template-columns: 1fr;
}

.public-action {
    min-height: 46px;
}

.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;
}

.activation-success {
    margin-top: 24px;
    border-radius: 18px;
    border: 1px solid rgba(7,193,96,.24);
    background: #f0fff7;
    color: #067647;
    padding: 22px 18px;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.8;
    text-align: center;
    box-shadow: 0 14px 34px rgba(7,193,96,.13);
    position: relative;
    overflow: hidden;
}

.activation-success::before {
    content: "✓";
    display: inline-flex;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    margin-right: 8px;
    font-weight: 900;
}

.simple-result {
    display: grid;
    gap: 14px;
    text-align: center;
    border-radius: 18px;
    padding: 22px 18px;
    box-shadow: 0 14px 34px rgba(24,34,48,.08);
}

.simple-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    font-size: 17px;
    line-height: 1.8;
}

.simple-row span {
    color: var(--muted);
}

.status-text.success {
    color: #067647;
    background: #dcfce7;
    border: 1px solid rgba(7,193,96,.22);
    border-radius: 999px;
    padding: 2px 14px;
}

.status-text.danger {
    color: #c01818;
    background: #fee4e2;
    border: 1px solid rgba(217,45,32,.22);
    border-radius: 999px;
    padding: 2px 14px;
}

.simple-message {
    margin-top: 2px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.7;
}

.simple-message.success {
    background: #ecfdf3;
    color: #067647;
}

.simple-message.danger {
    background: #fff1f3;
    color: #c01818;
}

.auth-notice {
    margin-top: 24px;
    padding: 20px 18px;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid var(--line);
    text-align: left;
}

.auth-notice h3 {
    margin: 0 0 12px;
    color: var(--primary-dark);
    font-size: 18px;
}

.auth-notice ul {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 9px;
    color: #344054;
    line-height: 1.7;
}

.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-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e7eef6;
    overflow: hidden;
    margin-bottom: 18px;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    box-shadow: 0 0 14px rgba(7,193,96,.35);
}

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

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

.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: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    line-height: 1.8;
    letter-spacing: 0;
}

.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;
    overflow: hidden;
}

.login-brand-pane {
    height: 118px;
    margin: -32px -32px 28px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-brand-pane .brand-icon {
    margin: 0;
}

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

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

.panel-page {
    background: #eef3f7;
}

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

.workspace {
    min-width: 0;
}

.mobile-topbar,
.sidebar-mask {
    display: none;
}

.sidebar {
    background: #111827;
    color: #fff;
    padding: 20px 14px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: start;
}

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

.sidebar-logo {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    flex: 0 0 auto;
}

.sidebar-brand b {
    display: block;
    font-size: 17px;
}

.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: 12px 12px;
    border-radius: 12px;
    color: rgba(255,255,255,.78);
    margin-bottom: 5px;
    font-weight: 700;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-icon {
    width: 18px;
    height: 18px;
    color: rgba(255,255,255,.68);
}

.nav-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,.34);
    flex: 0 0 auto;
}

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

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    color: var(--primary);
}

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

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(24,34,48,.05);
}

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

.topbar-title {
    display: flex;
}

.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(auto-fit, minmax(160px, 1fr));
}

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

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

.stat-card {
    min-height: 150px;
    position: relative;
    overflow: hidden;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.stat-icon .icon {
    width: 24px;
    height: 24px;
}

.stat-chip {
    position: absolute;
    top: 18px;
    right: 18px;
    min-width: 48px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #667085;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.stat-blue .stat-icon { background: #eff6ff; color: #2f6fed; }
.stat-green .stat-icon { background: #ecfdf3; color: var(--primary); }
.stat-orange .stat-icon { background: #fff7ed; color: #f97316; }
.stat-purple .stat-icon { background: #f5f3ff; color: #8b5cf6; }

.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;
}

.dashboard-announcements {
    margin-bottom: 16px;
}

.dashboard-account {
    margin-top: 16px;
}

.account-head {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.account-avatar {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: #ecfdf3;
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    overflow: hidden;
    flex: 0 0 auto;
}

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

.account-subtitle {
    margin: -8px 0 0;
    color: var(--muted);
}

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

.account-info-item {
    min-height: 78px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.account-info-item span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.account-info-item strong {
    font-size: 17px;
    word-break: break-all;
}

.account-info-item.wide {
    grid-column: span 2;
}

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

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

.card-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.status-tile {
    min-height: 132px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
    padding: 20px;
    display: grid;
    gap: 8px;
    align-content: center;
    box-shadow: 0 8px 24px rgba(24,34,48,.05);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.status-tile:hover,
.status-tile.active {
    border-color: var(--primary);
    box-shadow: 0 14px 30px rgba(7,193,96,.10);
    transform: translateY(-1px);
}

.status-tile strong {
    font-size: 32px;
    line-height: 1;
}

.status-tile span:last-child {
    color: var(--muted);
    font-weight: 800;
}

.status-tile-icon {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-tile-icon .icon {
    width: 23px;
    height: 23px;
}

.status-tile-icon.blue { background: #eff6ff; color: #2f6fed; }
.status-tile-icon.green { background: #ecfdf3; color: var(--primary); }
.status-tile-icon.red { background: #fff1f3; color: #ef4444; }
.status-tile-icon.orange { background: #fff7ed; color: #f59e0b; }

.cards-toolbar-card {
    margin-bottom: 16px;
}

.cards-filter-toolbar {
    margin-bottom: 0;
}

.search-field {
    min-width: min(360px, 100%);
    flex: 1 1 280px;
    position: relative;
}

.search-field .input {
    width: 100%;
    padding-left: 42px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #98a2b3;
    z-index: 1;
}

.cards-list-card {
    padding: 22px;
}

.cards-list-head {
    align-items: center;
    margin-bottom: 16px;
}

.list-count {
    color: var(--muted);
    font-weight: 800;
}

.cards-table {
    min-width: 1160px;
}

.cards-table th,
.cards-table td {
    white-space: nowrap;
}

.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;
}

.toolbar > * {
    flex: 0 0 auto;
}

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

.key-text {
    font-family: Consolas, Monaco, "Courier New", monospace;
    word-break: normal;
    white-space: nowrap;
}

.generate-card,
.agent-create-card {
    max-width: 760px;
}

.agent-list-card {
    margin-top: 16px;
    padding: 22px;
}

.agent-table {
    min-width: 1120px;
}

.agent-table th,
.agent-table td {
    white-space: nowrap;
}

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

.generate-form .field:first-of-type,
.generate-form .field:nth-of-type(3),
.generate-form .button,
.agent-form .check-line,
.agent-form .button {
    grid-column: 1 / -1;
}

.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);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15,23,42,.52);
}

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

body.modal-open {
    overflow: hidden;
}

.modal-card {
    width: min(520px, 100%);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow);
    animation: softIn .22s ease both;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.modal-head .card-title {
    margin-bottom: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

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

.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-template-columns: 1fr;
    }

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

    .brand-pane {
        padding: 30px;
    }

    .form-pane {
        padding: 30px;
    }

    .main {
        padding: 18px 14px 22px;
    }

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

    .panel-shell {
        display: block;
    }

    .mobile-topbar {
        position: sticky;
        top: 0;
        z-index: 35;
        display: flex;
        align-items: center;
        gap: 12px;
        height: 58px;
        padding: 0 14px;
        background: rgba(255,255,255,.96);
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(10px);
    }

    .mobile-topbar strong {
        font-size: 17px;
    }

    .menu-button {
        width: 40px;
        height: 40px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        cursor: pointer;
    }

    .menu-button span {
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: #182230;
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        width: min(286px, 82vw);
        min-height: 100vh;
        transform: translateX(-105%);
        transition: transform .22s ease;
        overflow-y: auto;
    }

    .sidebar-mask {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(15,23,42,.48);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s ease;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-mask {
        opacity: 1;
        pointer-events: auto;
    }

    .user-pill {
        width: 100%;
        justify-content: flex-start;
    }

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

    .toolbar .button {
        width: 100%;
    }

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

    .card-status-grid,
    .account-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .account-info-item.wide {
        grid-column: 1 / -1;
    }

    .cards-filter-toolbar {
        flex-direction: row;
        align-items: stretch;
    }

    .cards-filter-toolbar .search-field {
        flex: 1 1 100%;
        width: 100%;
    }

    .cards-filter-toolbar .button,
    .cards-filter-toolbar > a {
        width: calc(50% - 5px);
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
    }

    .generate-card,
    .agent-create-card {
        max-width: none;
    }

    .card {
        padding: 16px;
        border-radius: 16px;
    }

    .table-wrap {
        margin-left: -16px;
        margin-right: -16px;
        padding: 0 16px;
    }

    .table {
        min-width: 720px;
    }

    .cards-table {
        min-width: 1120px;
    }

    .agent-table {
        min-width: 1120px;
    }

    .stat-value {
        font-size: 26px;
    }

    .panel-footer {
        margin-bottom: 8px;
    }
}

@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;
    }

    .login-brand-pane {
        height: 104px;
        margin: -22px -22px 24px;
    }

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

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

    .public-card {
        border-radius: 18px;
    }

    .brand-pane {
        min-height: 92px;
        display: grid;
        align-items: center;
    }

    .brand-pane h1 {
        font-size: 23px;
    }

    .page-title h2 {
        font-size: 19px;
    }

    .public-action-row {
        gap: 10px;
    }

    .public-action {
        min-height: 44px;
        padding-left: 8px;
        padding-right: 8px;
        font-size: 14px;
    }

    .activation-success {
        font-size: 16px;
        padding: 18px 14px;
    }

    .simple-row {
        font-size: 16px;
    }

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

    .status-tile {
        min-height: 118px;
        padding: 16px;
    }

    .status-tile strong {
        font-size: 28px;
    }

    .cards-filter-toolbar .button,
    .cards-filter-toolbar > a {
        width: 100%;
        flex-basis: 100%;
    }

    .modal-actions {
        grid-template-columns: 1fr;
    }
}
