:root {
    color-scheme: light;
    --page: #f5f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #4b4f56;
    --heading: #34383e;
    --muted: #8a919b;
    --line: #e4e8ef;
    --primary: #7888fc;
    --primary-strong: #5470f1;
    --cyan: #67cbd3;
    --green: #57c6a4;
    --red: #ef7587;
    --amber: #e6ae4f;
    --shadow: 0 3px 14px rgba(49, 60, 75, .06);
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
    background: var(--page);
}

body {
    margin: 0;
    color: var(--text);
    background: var(--page);
    font-family: Arial, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.55;
}

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

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

a {
    color: var(--primary-strong);
    text-decoration: none;
}

button,
summary {
    cursor: pointer;
}

img,
svg {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: var(--heading);
}

form {
    margin: 0;
}

input,
select,
textarea {
    min-height: 42px;
    padding: 9px 13px;
    border: 1px solid #dfe3e9;
    border-radius: 7px;
    outline: none;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #9aa7fa;
    box-shadow: 0 0 0 3px rgba(120, 136, 252, .12);
}

input:disabled {
    color: #60656c;
    background: #f1f3f7;
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.alert {
    max-width: 1030px;
    margin: 0 auto 14px;
    padding: 11px 15px;
    border: 1px solid #dfe4ec;
    border-radius: 7px;
    background: #fff;
}
.alert[role="status"] {
    position: fixed;
    z-index: 320;
    top: 50%;
    left: 50%;
    width: min(390px, calc(100vw - 34px));
    max-width: none;
    margin: 0;
    padding: 15px 18px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 22px 60px rgba(19, 28, 45, .26);
    transform: translate(-50%, calc(-50% + var(--toast-offset, 0px))) scale(1);
    transition: opacity .22s ease, transform .22s ease;
}
.alert[role="status"].is-hiding {
    opacity: 0;
    transform: translate(-50%, calc(-50% + var(--toast-offset, 0px))) scale(.96);
}

.alert-success { color: #277a5e; border-color: #bde6d7; background: #f1fbf7; }
.alert-warning { color: #946412; border-color: #efdbb3; background: #fffaf0; }
.alert-critical { color: #b64055; border-color: #efc2ca; background: #fff5f6; }

/* Install wizard */

.install-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 12%, rgba(120, 136, 252, .24), transparent 34%),
        radial-gradient(circle at 88% 18%, rgba(103, 203, 211, .2), transparent 31%),
        linear-gradient(135deg, #f8fbff 0%, #eef3ff 45%, #f7fbff 100%);
}

.cloud-install-shell {
    display: grid;
    grid-template-columns: minmax(320px, .92fr) minmax(420px, 1.08fr);
    gap: 28px;
    width: min(1180px, calc(100% - 42px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 42px 0;
    align-items: center;
}

.cloud-install-hero,
.cloud-install-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .78);
    border-radius: 28px;
    background: rgba(255, 255, 255, .76);
    box-shadow: 0 24px 70px rgba(61, 80, 132, .16);
    backdrop-filter: blur(18px);
}

.cloud-install-hero {
    min-height: 650px;
    padding: 38px;
    color: #536073;
    background:
        linear-gradient(155deg, rgba(30, 42, 75, .92), rgba(76, 86, 164, .9)),
        linear-gradient(135deg, rgba(120, 136, 252, .22), rgba(103, 203, 211, .16));
}

.cloud-install-hero::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -130px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}

.install-brand {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.cloud-install-logo,
.install-brand .brand-symbol {
    width: 30px;
    height: 30px;
    max-width: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
}

.cloud-install-hero .eyebrow {
    position: relative;
    z-index: 1;
    margin: 54px 0 10px;
    color: rgba(255, 255, 255, .7);
}

.cloud-install-hero h1 {
    position: relative;
    z-index: 1;
    margin-bottom: 18px;
    color: #fff;
    font-size: clamp(34px, 4vw, 54px);
    line-height: 1.08;
    letter-spacing: -1px;
}

.install-lead {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin-bottom: 30px;
    color: rgba(255, 255, 255, .78);
    font-size: 16px;
}

.install-requirements {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    margin: 34px 0;
}

.install-requirements > div {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 16px;
    color: rgba(255, 255, 255, .88);
    background: rgba(255, 255, 255, .1);
}

.install-requirements svg {
    flex: 0 0 auto;
    color: #a9f1ff;
}

.install-requirements code,
.install-note code,
.install-success code {
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(15, 23, 42, .08);
}

.install-note {
    position: relative;
    z-index: 1;
    margin-top: 28px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 18px;
    color: rgba(255, 255, 255, .78);
    background: rgba(255, 255, 255, .1);
}

.install-note strong {
    display: block;
    margin-bottom: 6px;
    color: #fff;
}

.install-note p {
    margin-bottom: 0;
}

.cloud-install-panel {
    padding: 32px;
}

.install-alert {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 14px;
}

.install-alert-error {
    color: #b64055;
    border: 1px solid #efc2ca;
    background: #fff5f6;
}

.install-alert-success {
    color: #287a61;
    border: 1px solid #bde6d7;
    background: #f1fbf7;
}

.install-panel-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.install-panel-head > span {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 18px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    box-shadow: 0 12px 28px rgba(84, 112, 241, .22);
}

.install-panel-head .eyebrow {
    margin-bottom: 3px;
}

.install-panel-head h2 {
    margin-bottom: 0;
    font-size: 25px;
}

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

.install-steps > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e8edf7;
    border-radius: 14px;
    color: #8b94a3;
    background: #fbfdff;
}

.install-steps span {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    border-radius: 50%;
    color: #8b94a3;
    background: #edf1f8;
    font-size: 12px;
    font-weight: 700;
}

.install-steps > div.active {
    color: #4f5ff1;
    border-color: rgba(120, 136, 252, .34);
    background: rgba(120, 136, 252, .08);
}

.install-steps > div.active span {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
}

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

.install-form-section {
    display: grid;
    gap: 14px;
    padding: 20px;
    border: 1px solid #e8edf7;
    border-radius: 22px;
    background: #fbfdff;
}

.install-form-section h3 {
    margin-bottom: -8px;
    font-size: 18px;
}

.install-form-section p {
    margin-bottom: 2px;
    color: var(--muted);
}

.cloud-install-form label,
.install-result-list label {
    display: grid;
    gap: 7px;
    color: #4a5362;
    font-weight: 600;
}

.cloud-install-form input,
.install-result-list input {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    font-weight: 400;
}

.install-grid {
    display: grid;
    gap: 14px;
}

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

.install-db-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid #bde6d7;
    border-radius: 16px;
    background: #f1fbf7;
}

.install-db-summary strong,
.install-db-summary span {
    display: block;
}

.install-db-summary strong {
    color: #287a61;
}

.install-db-summary span {
    margin-top: 3px;
    color: #5f6c7d;
    word-break: break-all;
}

.install-residue-warning {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    padding: 15px 16px;
    border: 1px solid #efdbb3;
    border-radius: 16px;
    color: #735318;
    background: #fffaf0;
}

.install-residue-warning strong {
    color: #8a5c0a;
}

.install-residue-warning p {
    margin-bottom: 0;
}

.install-residue-warning summary {
    color: #4f5ff1;
}

.install-residue-warning details > div {
    margin-top: 8px;
    word-break: break-all;
}

.install-clean-option {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 5px 10px !important;
    padding: 13px;
    border: 1px solid #efdbb3;
    border-radius: 14px;
    color: #725414;
    background: #fffaf0;
}

.install-clean-option input {
    min-height: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.install-clean-option span {
    font-weight: 700;
}

.install-clean-option small {
    grid-column: 2;
    color: #927244;
    font-weight: 400;
}

.install-submit {
    min-height: 48px;
    border-radius: 14px;
    font-size: 16px;
}

.install-footnote {
    margin: -6px 0 0;
    color: var(--muted);
    text-align: center;
}

.install-success {
    display: grid;
    min-height: 420px;
    align-content: center;
    gap: 18px;
    text-align: center;
}

.install-success-icon {
    display: grid;
    width: 74px;
    height: 74px;
    margin: 0 auto 4px;
    place-items: center;
    border-radius: 24px;
    color: #fff;
    background: linear-gradient(135deg, var(--green), var(--cyan));
    box-shadow: 0 16px 34px rgba(87, 198, 164, .22);
}

.install-success-icon.warning {
    background: linear-gradient(135deg, var(--amber), #f2c46f);
}

.install-success h2 {
    margin-bottom: -8px;
    font-size: 28px;
}

.install-success > p {
    width: min(520px, 100%);
    margin: 0 auto;
    color: var(--muted);
}

.install-result-list {
    display: grid;
    gap: 12px;
    width: min(520px, 100%);
    margin: 4px auto;
    text-align: left;
}

.install-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 980px) {
    .cloud-install-shell {
        grid-template-columns: 1fr;
        width: min(760px, calc(100% - 30px));
        padding: 24px 0;
    }
    .cloud-install-hero {
        min-height: auto;
        padding: 30px;
    }
    .cloud-install-hero .eyebrow {
        margin-top: 34px;
    }
}

@media (max-width: 560px) {
    .cloud-install-shell {
        width: calc(100% - 20px);
        padding: 10px 0;
        gap: 14px;
    }
    .cloud-install-hero,
    .cloud-install-panel {
        border-radius: 20px;
    }
    .cloud-install-hero,
    .cloud-install-panel {
        padding: 20px;
    }
    .install-grid.two {
        grid-template-columns: 1fr;
    }
    .install-steps {
        grid-template-columns: 1fr;
    }
    .install-db-summary {
        align-items: stretch;
        flex-direction: column;
    }
    .install-form-section {
        padding: 16px;
        border-radius: 17px;
    }
    .install-panel-head {
        align-items: flex-start;
    }
    .install-panel-head h2 {
        font-size: 22px;
    }
    .install-actions .button {
        width: 100%;
    }
}

/* Public entry */

.portal-page {
    min-height: 100vh;
    overflow: hidden;
    background: #131622;
}

.portal-hero {
    position: relative;
    min-height: 100svh;
    overflow: hidden;
    color: #fff;
    background-image: url("./portal-background.jpg");
    background-position: center;
    background-size: cover;
}

.portal-shade {
    position: absolute;
    inset: 0;
    background: rgba(24, 22, 39, .42);
}

.portal-content {
    position: relative;
    z-index: 3;
    display: flex;
    width: min(640px, calc(100% - 40px));
    min-height: calc(100svh - 110px);
    margin: 0 auto;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    padding: 52px 0 140px;
    text-align: center;
}

.portal-avatar {
    width: 92px;
    height: 92px;
    margin-bottom: 34px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #fff;
    object-fit: cover;
}

.portal-line {
    width: 390px;
    max-width: 85%;
    height: 1px;
    background: rgba(255, 255, 255, .58);
}

.portal-content h1 {
    margin: 47px 0 18px;
    color: #fff;
    font-size: 40px;
    line-height: 1.2;
}

.portal-content p {
    margin-bottom: 0;
    color: rgba(255, 255, 255, .86);
    font-size: 15px;
}

.portal-line-lower {
    margin-top: 48px;
}

.portal-actions {
    display: grid;
    width: 254px;
    margin-top: 56px;
    grid-template-columns: repeat(2, 1fr);
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 4px;
}

.portal-actions a {
    display: grid;
    min-height: 48px;
    place-items: center;
    color: #fff;
}

.portal-actions a + a {
    border-left: 1px solid rgba(255, 255, 255, .55);
}

.portal-actions a:hover {
    background: rgba(255, 255, 255, .14);
}

.portal-footer {
    position: absolute;
    z-index: 3;
    right: 20px;
    bottom: 24px;
    left: 20px;
    display: flex;
    align-items: center;
    flex-direction: column;
    color: rgba(255, 255, 255, .7);
    font-size: 11px;
    line-height: 1.7;
    text-transform: uppercase;
}

.portal-footer a { color: rgba(255, 255, 255, .78); }

.portal-hero.theme-clean .portal-shade { background: rgba(245, 248, 250, .78); }
.portal-hero.theme-clean .portal-content h1,
.portal-hero.theme-clean .portal-content p,
.portal-hero.theme-clean .portal-actions a,
.portal-hero.theme-clean .portal-footer,
.portal-hero.theme-clean .portal-footer a { color: #2f3942; }
.portal-hero.theme-clean .portal-line { background: rgba(47, 57, 66, .42); }
.portal-hero.theme-clean .portal-actions { border-color: rgba(47, 57, 66, .58); background: rgba(255, 255, 255, .46); }
.portal-hero.theme-clean .portal-actions a + a { border-left-color: rgba(47, 57, 66, .34); }
.portal-hero.theme-classic .portal-shade { background: rgba(18, 24, 30, .68); }
.portal-hero.theme-classic .portal-content { align-items: flex-start; text-align: left; }
.portal-hero.theme-classic .portal-actions { margin-right: auto; }

.petal-layer {
    position: absolute;
    z-index: 2;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.petal-layer i {
    position: absolute;
    top: -9%;
    width: 13px;
    height: 8px;
    border-radius: 90% 15% 80% 20%;
    background: rgba(255, 190, 192, .78);
    animation: petal-fall 12s linear infinite;
}

.petal-layer i:nth-child(3n) { width: 9px; height: 6px; animation-duration: 16s; }
.petal-layer i:nth-child(2n) { background: rgba(255, 229, 226, .82); animation-duration: 10s; }
.petal-layer i:nth-child(1) { left: 3%; animation-delay: -5s; }
.petal-layer i:nth-child(2) { left: 9%; animation-delay: -1s; }
.petal-layer i:nth-child(3) { left: 16%; animation-delay: -9s; }
.petal-layer i:nth-child(4) { left: 23%; animation-delay: -3s; }
.petal-layer i:nth-child(5) { left: 29%; animation-delay: -7s; }
.petal-layer i:nth-child(6) { left: 36%; animation-delay: -11s; }
.petal-layer i:nth-child(7) { left: 43%; animation-delay: -2s; }
.petal-layer i:nth-child(8) { left: 49%; animation-delay: -8s; }
.petal-layer i:nth-child(9) { left: 54%; animation-delay: -4s; }
.petal-layer i:nth-child(10) { left: 61%; animation-delay: -10s; }
.petal-layer i:nth-child(11) { left: 67%; animation-delay: -6s; }
.petal-layer i:nth-child(12) { left: 72%; animation-delay: -12s; }
.petal-layer i:nth-child(13) { left: 78%; animation-delay: -3s; }
.petal-layer i:nth-child(14) { left: 83%; animation-delay: -8s; }
.petal-layer i:nth-child(15) { left: 88%; animation-delay: -1s; }
.petal-layer i:nth-child(16) { left: 93%; animation-delay: -6s; }
.petal-layer i:nth-child(17) { left: 97%; animation-delay: -11s; }
.petal-layer i:nth-child(18) { left: 57%; animation-delay: -14s; }

@keyframes petal-fall {
    from { transform: translate3d(0, -5vh, 0) rotate(0); }
    to { transform: translate3d(14vw, 115vh, 0) rotate(640deg); }
}

/* Public secondary pages and auth */

.public-nav {
    display: flex;
    width: min(1100px, calc(100% - 32px));
    min-height: 70px;
    margin: 20px auto;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.public-brand { display: flex; align-items: center; gap: 10px; color: var(--heading); }
.public-brand img { width: 34px; height: 34px; }
.public-nav nav { display: flex; gap: 20px; }
.public-main { width: min(1100px, calc(100% - 32px)); margin: 0 auto 50px; }

.mode-auth {
    min-height: 100vh;
    background: #1a1f24 url("./portal-background.jpg") center / cover fixed;
}

.auth-page {
    display: grid;
    min-height: 100svh;
    place-items: center;
    padding: 32px 16px;
    background: rgba(18, 24, 30, .68);
}

.auth-card {
    width: min(410px, 100%);
    padding: 25px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .24);
}

.auth-card h1 { margin: 24px 0; font-size: 22px; text-align: center; }
.auth-back { display: inline-flex; padding: 7px 12px; border: 1px solid #727b84; border-radius: 6px; color: #394047; }
.auth-form { display: grid; gap: 15px; }
.auth-form label { display: grid; gap: 6px; color: #555c64; }
.auth-form button {
    min-height: 43px;
    border: 0;
    border-radius: 6px;
    color: #fff;
    background: #5bc0de;
}
.auth-form button:hover { background: #46b8da; }
.auth-foot { margin: 18px 0 0; color: #7a828a; text-align: center; }
.auth-card .alert { margin-top: 0; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); }
.auth-divider::before,
.auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.qq-oauth-button { display: flex; min-height: 43px; align-items: center; justify-content: center; border: 1px solid #b7d9ed; border-radius: 6px; color: #267ca8; background: #f3fbff; }
.generated-token { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 15px 0; padding: 12px; border: 1px solid #bde6d7; border-radius: 7px; background: #f1fbf7; }
.generated-token input { width: 100%; font-family: Consolas, monospace; }

/* User center, matching the original three-tab layout */

.mode-user { min-height: 100vh; background: #f4f5f9; }

.user-shell {
    width: min(1030px, calc(100% - 32px));
    margin: 22px auto 60px;
}

.user-page-header,
.user-tabs {
    border: 1px solid #e4e8ef;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(54, 74, 99, .05);
}

.user-page-header {
    min-height: 112px;
    padding: 17px 25px;
    text-align: center;
}

.user-page-header h1 {
    margin: 0 0 5px;
    font-size: 37px;
    font-weight: 600;
}

.user-page-header p { margin: 0; color: #555b63; font-size: 18px; }

.user-tabs {
    display: flex;
    min-height: 56px;
    margin: 16px 0;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 20px;
}

.user-tabs a {
    min-width: 48px;
    padding: 8px 10px;
    border-radius: 9px;
    color: #5b5b5b;
    text-align: center;
}

.user-tabs a:hover,
.user-tabs a.active { color: #7889ff; background: #f3f6fa; }
.user-content { min-width: 0; }

.user-toolbar {
    position: relative;
    display: flex;
    min-height: 40px;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0 3px 10px;
}

.outline-button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 11px;
    border: 1px solid currentColor;
    border-radius: 9px;
    color: var(--primary);
    background: transparent;
    line-height: 1.2;
}

.outline-button.primary { color: #6f82f0; }
.outline-button.dark { color: #596069; }
.outline-button.warning { color: #dfa942; }
.outline-button.success { color: #55bda4; }
.outline-button.danger { color: #c65062; }

summary.outline-button { list-style: none; }
summary.outline-button::-webkit-details-marker { display: none; }

.toolbar-popover { position: relative; }
.toolbar-popover > div {
    position: absolute;
    z-index: 20;
    top: 43px;
    left: 0;
    width: min(330px, 80vw);
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 15px 35px rgba(44, 55, 70, .16);
}
.toolbar-popover p { color: #666d75; }

.qq-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px 29px;
}

.qq-card {
    min-width: 0;
    overflow: visible;
    border: 1px solid #e5e4eb;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .05);
}

.qq-card-header {
    display: flex;
    min-height: 100px;
    align-items: center;
    gap: 13px;
    padding: 14px 21px;
    border-radius: 15px 15px 0 0;
    border-bottom: 1px solid #eef7fb;
    background: #edf8fb;
}

.qq-card-header > img {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    padding: 3px;
    border: 2px solid #1688f3;
    border-radius: 50%;
    background: #fff;
    object-fit: cover;
}

.qq-card-header > div { min-width: 0; }
.qq-card-header h2 { margin: 0 0 4px; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.qq-status-row { display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; }
.qq-status-row form { display: inline-flex; }

.status-tag {
    display: inline-flex;
    min-height: 20px;
    align-items: center;
    padding: 0 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #64748b;
    background: #f8fafc;
    font-size: 12px;
    white-space: nowrap;
}

.status-tag.online { color: #16a34a; border-color: #dcfce7; background: #f0fdf4; }

.mini-action {
    display: inline-flex;
    height: 20px;
    align-items: center;
    padding: 0 5px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
}
.mini-action.blue { background: #0788eb; }
.mini-action.cyan { background: #6acbd2; }
.mini-action.warning { background: #dfa942; }
.mini-action.danger { background: #f37986; }

.qq-card-body { padding: 16px 21px 20px; }
.qq-info-row { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; margin-bottom: 8px; font-size: 15px; }
.qq-info-row strong { color: #333; white-space: nowrap; }
.qq-info-row span { overflow: hidden; color: #7185f6; text-overflow: ellipsis; white-space: nowrap; }
.qq-info-row b { color: #959595; font-size: 22px; line-height: 1; }

.qq-card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 15px; }
.qq-card-actions > a,
.qq-card-actions > details > summary {
    display: grid;
    min-height: 30px;
    place-items: center;
    list-style: none;
    border: 1px solid #7d8def;
    border-radius: 9px;
    color: #6f7fec;
    font-size: 13px;
}
.qq-card-actions > details { position: relative; }
.qq-card-actions > details > summary { border-color: #ef8395; color: #e77387; }
.qq-card-actions > details > summary::-webkit-details-marker { display: none; }
.qq-action-menu {
    position: absolute;
    z-index: 15;
    right: 0;
    bottom: 38px;
    width: 240px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(40, 51, 64, .16);
}
.qq-action-menu p { margin-bottom: 7px; color: #687079; }
.qq-action-menu a,
.qq-action-menu button { display: block; width: 100%; padding: 7px 0; border: 0; border-top: 1px solid var(--line); color: #6574dd; background: transparent; text-align: left; }
.qq-action-menu form { margin: 0; }
.qq-action-menu form button { color: #b4495b; cursor: pointer; }

.user-pagination { display: flex; align-items: center; gap: 7px; margin: 19px 3px 0; }
.user-pagination select { width: 62px; min-height: 38px; padding: 5px 11px; }

.user-empty-card {
    display: flex;
    min-height: 280px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
    text-align: center;
}
.user-empty-card h2 { margin: 12px 0 5px; }
.user-empty-card p { color: var(--muted); }

.classic-card,
.panel {
    border: 1px solid #e5e9f2;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(54, 74, 99, .05);
}

.mode-user .classic-card,
.mode-user .panel { border-radius: 15px; }

.purchase-card { padding: 12px 18px 32px; }
.purchase-card > h2,
.connection-table-card > h2 { margin: 0 0 28px; font-size: 19px; font-weight: 500; }

.classic-form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 155px minmax(0, 1fr); align-items: center; gap: 16px; }
.form-row > label { padding-left: 2px; }
.form-row input,
.form-row select { width: 100%; }
.account-meta-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 124px;
    min-width: 0;
    align-items: center;
    gap: 10px;
}
.account-meta-controls > label { color: #555d66; white-space: nowrap; }
.account-meta-controls > input,
.account-meta-controls > select { min-width: 0; }
.input-combo { display: grid; grid-template-columns: minmax(0, 1fr) 126px; }
.input-combo input { border-radius: 7px 0 0 7px; }
.input-combo select { border-left: 0; border-radius: 0 7px 7px 0; }
.api-test-combo { display: grid; grid-template-columns: minmax(0, 1fr) 118px; }
.api-test-combo input { min-width: 0; border-radius: 7px 0 0 7px; }
.api-test-combo .button { min-height: 42px; padding-inline: 9px; border-radius: 0 7px 7px 0; white-space: nowrap; }
.api-test-result { min-height: 18px; color: var(--muted); font-size: 12px; }
.api-test-result.is-success { color: #258461; }
.api-test-result.is-error { color: #b4495b; }
.api-test-result.is-loading { color: #6475df; }
.classic-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.account-banner {
    display: flex;
    min-height: 148px;
    align-items: center;
    gap: 27px;
    margin: 0 4px 27px;
    padding: 16px 20px;
    border-radius: 15px;
    background: linear-gradient(180deg, #a9c9ff 0%, #ffbbec 100%);
}
.account-banner img { width: 112px; height: 112px; padding: 4px; border: 1px solid #fff; border-radius: 50%; background: #fff; object-fit: cover; }
.account-banner h2,
.account-banner p { margin: 0 0 2px; color: #fff; font-size: 18px; font-weight: 600; }
.account-banner .outline-button { min-height: 32px; margin-top: 4px; }
.blue-text { color: #1688f3; }
.orange-text { color: #f3a04a; }

.profile-menu { display: grid; gap: 3px; padding: 20px 25px; }
.profile-menu > a,
.profile-menu > details > summary { padding: 8px 0; list-style: none; color: #555b63; }
.profile-menu > details > summary::-webkit-details-marker { display: none; }
.profile-edit-form { margin: 8px 0 12px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #f9fafc; }
.logout-card { margin-top: 28px; padding: 20px 25px; }
.logout-card button { border: 0; color: #555b63; background: none; }

.add-qq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.add-qq-grid .classic-card { padding: 22px; }
.login-help-card p { color: #6d747c; white-space: pre-line; }
.login-flow-open { overflow: hidden; }
.login-flow-modal {
    position: fixed;
    z-index: 150;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
}
.login-flow-modal[hidden] { display: none; }
.login-flow-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 27, 39, .56);
    backdrop-filter: blur(4px);
}
.login-flow-dialog {
    position: relative;
    z-index: 1;
    width: min(460px, 100%);
    max-height: min(720px, calc(100svh - 36px));
    overflow: hidden;
    border: 1px solid #dfe7f3;
    border-radius: 16px;
    background: #f8fbff;
    box-shadow: 0 24px 60px rgba(19, 28, 45, .24);
}
.login-flow-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 15px;
    border-bottom: 1px solid #e6edf7;
    background: #fff;
}
.login-flow-content {
    max-height: calc(100svh - 180px);
    overflow-y: auto;
    padding: 16px;
    color: #3f4650;
}
.login-flow-content p { margin: 0 0 10px; }
.login-flow-foot {
    display: flex;
    justify-content: flex-end;
    padding: 12px 15px;
    border-top: 1px solid #e6edf7;
    background: #fff;
}
.login-flow-qr {
    display: block;
    width: 190px;
    height: 190px;
    margin: 8px auto 12px;
    border-radius: 10px;
    background: #fff;
    object-fit: contain;
}
.login-flow-captcha-frame {
    display: block;
    width: 100%;
    height: min(560px, calc(100svh - 230px));
    min-height: 420px;
    margin: 0 0 12px;
    border: 1px solid #dce5f2;
    border-radius: 10px;
    background: #f7f9fc;
}
.login-flow-inline,
.login-flow-grid {
    display: grid;
    gap: 8px;
}
.login-flow-inline { grid-template-columns: minmax(0, 1fr) 92px; }
.login-flow-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 100px; }
.login-flow-success { color: #258461; }
.login-flow-error { color: #b4495b; }
.login-flow-warn { color: #b7791f; }
.notice-box { padding: 12px; border-radius: 7px; color: #3b6986; background: #edf8fb; }
.connection-table-card { margin-top: 18px; padding: 20px; }
.connection-edit-card { margin-top: 18px; }
.connection-edit-card > h2 { margin: 0 0 20px; font-size: 19px; font-weight: 500; }
.connection-delete-form { display: flex; justify-content: flex-end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Admin layout */

.mode-admin { min-height: 100vh; background: #f4f5f9; }
.admin-shell {
    display: grid;
    min-height: 100vh;
    grid-template: 74px 1fr / 236px minmax(0, 1fr);
    gap: 28px 32px;
    padding: 24px 40px 40px;
}

.admin-topbar {
    display: flex;
    min-width: 0;
    grid-column: 1 / 3;
    align-items: center;
    padding: 0 26px;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.admin-back-button {
    display: grid;
    width: 34px;
    height: 34px;
    margin-right: 8px;
    place-items: center;
    border: 0;
    background: transparent;
}

.admin-topbar nav { display: flex; align-items: center; gap: 26px; }
.admin-topbar nav a { color: #555d66; }
.admin-account { position: relative; margin-left: auto; }
.admin-account > img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.admin-account-menu {
    position: absolute;
    z-index: 40;
    top: 42px;
    right: 0;
    display: none;
    width: 178px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(38, 48, 62, .16);
}
.admin-account-menu::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 100%;
    width: 100%;
    height: 10px;
}
.admin-account:hover .admin-account-menu,
.admin-account.is-open .admin-account-menu,
.admin-account:focus-within .admin-account-menu { display: block; }
.admin-account-menu strong { display: block; margin-bottom: 8px; }
.admin-account-menu button { display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; }

.admin-sidebar {
    min-width: 0;
    padding: 20px 22px 28px;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.admin-nav-title { margin: 7px 0 10px; color: #969ca5; font-size: 12px; }
.admin-nav-title:not(:first-child) { margin-top: 22px; }
.admin-nav { display: grid; gap: 4px; }
.admin-nav a {
    display: grid;
    min-height: 42px;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 0 0;
    border-radius: 6px;
    color: #525962;
}
.admin-nav a b { color: #747b84; font-size: 22px; font-weight: 400; }
.admin-nav a:hover,
.admin-nav a.active { color: #6e7fec; }

.admin-main { min-width: 0; }
.admin-main > .alert { max-width: none; }

.admin-license-grid {
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    gap: 28px;
    margin-bottom: 28px;
}
.admin-license-panel {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-top: 3px solid #aeb6c2;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}
.admin-license-panel.license-tone-success { border-top-color: var(--green); }
.admin-license-panel.license-tone-warning { border-top-color: var(--amber); }
.admin-license-panel.license-tone-critical { border-top-color: var(--red); }
.admin-license-heading {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}
.admin-license-heading p { margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.admin-license-heading h2 { margin: 0; font-size: 18px; }
.admin-license-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    color: #277a5e;
    background: #edf9f5;
}
.admin-license-icon.update-icon { color: #596bd4; background: #f0f2ff; }
.license-state-badge,
.current-version {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    color: #646b75;
    background: #f1f3f6;
    font-size: 12px;
    white-space: nowrap;
}
.license-tone-success .license-state-badge { color: #277a5e; background: #edf9f5; }
.license-tone-warning .license-state-badge { color: #946412; background: #fff7e8; }
.license-tone-critical .license-state-badge { color: #b64055; background: #fff0f3; }
.admin-license-message { min-height: 22px; margin: 18px 0 14px; color: #606772; }
.admin-license-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
    margin: 0;
}
.admin-license-meta div { min-width: 0; }
.admin-license-meta dt { color: var(--muted); font-size: 12px; }
.admin-license-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; color: var(--heading); }
.admin-license-action { display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; }
.update-version-row { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.update-version-row strong { color: var(--heading); font-size: 22px; }
.update-version-row span { padding: 3px 8px; border-radius: 999px; color: #b64055; background: #fff0f3; font-size: 12px; }
.update-notes {
    min-height: 54px;
    margin-top: 10px;
    overflow-wrap: anywhere;
    color: #606772;
    line-height: 1.7;
}
.update-hash { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.update-hash span { display: block; margin-bottom: 4px; }
.update-hash code { display: block; overflow-wrap: anywhere; color: #606772; white-space: normal; }
.update-apply-form { margin-top: 16px; }
.update-history-panel { margin-top: 18px; }
.inline-update-form { display: inline-flex; margin: 0; }
.update-empty { display: grid; min-height: 126px; align-content: center; padding: 18px 0 4px; }
.update-empty strong { color: var(--heading); font-size: 16px; }
.update-empty p { margin: 6px 0 0; color: var(--muted); }

.license-client-layout {
    display: grid;
    grid-template-columns: minmax(260px, .78fr) minmax(0, 1.22fr);
    align-items: start;
    gap: 18px;
}
.license-client-summary,
.license-client-form-panel { min-width: 0; }
.license-summary-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px solid #e4e9f2;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8fbff 0%, #f2f5ff 100%);
}
.license-summary-card h2 { margin: 2px 0 8px; font-size: 19px; }
.license-summary-card .license-state-badge { width: fit-content; }
.license-summary-card.is-enabled .admin-license-icon { color: #277a5e; background: #edf9f5; }
.license-summary-card.is-disabled .admin-license-icon { color: #8a6270; background: #fff1f4; }
.license-client-tips,
.license-check-result {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.license-client-tips h3,
.license-check-result h3 { margin: 0 0 10px; font-size: 15px; }
.license-client-tips ol { margin: 0; padding-left: 18px; color: #606772; line-height: 1.75; }
.license-client-tips code {
    padding: 2px 5px;
    border-radius: 5px;
    color: #5868d9;
    background: #f1f3ff;
    font-size: 12px;
}
.license-check-result .alert { margin: 0; }
.license-client-form {
    display: grid;
    gap: 16px;
}
.license-form-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
    border: 1px solid #edf0f5;
    border-radius: 10px;
    background: #fbfcff;
}
.license-form-section > label {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: #404852;
    font-weight: 600;
}
.license-code-only-section > label { grid-column: 1 / -1; }
.license-form-section input,
.license-form-section select { width: 100%; }
.license-switch-row {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) 150px;
    align-items: center;
}
.license-switch-row span { display: grid; gap: 4px; }
.license-switch-row strong { color: var(--heading); }
.license-switch-row small { color: var(--muted); font-weight: 400; line-height: 1.45; }
.license-client-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 2px;
}

.ws-config { padding: 18px 20px 24px; }
.ws-config h2 { margin: 0 0 14px; font-size: 16px; font-weight: 500; }
.ws-config-row { display: grid; grid-template-columns: 1fr 1fr 1.15fr auto auto auto; align-items: center; gap: 12px; }
.soft-button {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border: 0;
    border-radius: 7px;
    white-space: nowrap;
}
.soft-button.mint { color: #55bda9; background: #dff9f5; }
.soft-button.rose { color: #dd7084; background: #fde7ec; }
.soft-button.lavender { color: #7180d8; background: #f0efff; }

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px;
    margin-top: 28px;
}
.admin-stat-grid article {
    position: relative;
    min-height: 128px;
    padding: 16px;
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}
.admin-stat-grid h2 { margin: 0 0 22px; font-size: 18px; font-weight: 500; }
.admin-stat-grid p { margin: 0; color: #a0a5ad; }
.admin-stat-grid strong { position: absolute; right: 17px; bottom: 17px; color: #51565c; font-size: 28px; font-weight: 500; }

.admin-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 28px; }
.dashboard-chart { min-width: 0; padding: 18px; }
.dashboard-chart svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 4px; color: #6c737b; font-size: 12px; }
.chart-legend i { width: 44px; height: 14px; }
.chart-legend i.teal { background: #40c6b7; }
.chart-legend i.blue { background: #1688ee; }
.chart-grid-lines line { stroke: #d8dde4; stroke-width: 1; }
.chart-line { fill: none; stroke-width: 3; }
.chart-line.teal { stroke: #40c6b7; }
.chart-line.blue { stroke: #1688ee; }
.dashboard-chart text { fill: #777f88; font-size: 10px; }

.interface-create { margin-bottom: 18px; }
.interface-create > summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    list-style: none;
    color: #4f5862;
    font-size: 16px;
    font-weight: 600;
}
.interface-create > summary::-webkit-details-marker { display: none; }
.interface-create[open] > summary { margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.interface-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.interface-form label { display: grid; align-content: start; gap: 6px; color: #5d6570; text-align: left; }
.interface-form input,
.interface-form select,
.interface-form textarea { width: 100%; }
.interface-form .span-2 { grid-column: span 2; }
.interface-form .span-4 { grid-column: 1 / -1; }
.interface-form-actions { display: flex; justify-content: flex-end; }
.interface-delete-form { display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.interface-table code {
    display: block;
    max-width: 210px;
    overflow: hidden;
    padding: 3px 6px;
    border-radius: 4px;
    color: #56616c;
    background: #f0f3f6;
    text-overflow: ellipsis;
}
.original-interface-table { min-width: 1380px; }
.original-interface-table th:last-child,
.original-interface-table td:last-child { min-width: 260px; }
.original-category-table { min-width: 760px; table-layout: fixed; }
.original-category-table th:nth-child(1) { width: 16%; }
.original-category-table th:nth-child(2) { width: 27%; }
.original-category-table th:nth-child(3) { width: 17%; }
.original-category-table th:nth-child(4) { width: 17%; }
.original-category-table th:nth-child(5) { width: 23%; }
.original-category-table input,
.original-category-table select { width: 100%; min-width: 0; min-height: 34px; padding: 5px 8px; }
.category-sort-cell { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.category-sort-cell span { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.original-category-table .category-sort-cell input { flex: 0 0 60px; width: 60px; }
.status-free { color: #258461; }
.interface-edit { position: relative; }
.interface-edit > summary { list-style: none; }
.interface-edit > summary::-webkit-details-marker { display: none; }
.interface-edit[open]::before {
    content: "";
    position: fixed;
    z-index: 79;
    inset: 0;
    background: rgba(21, 28, 36, .42);
}
.interface-modal-open { overflow: hidden; }
.interface-edit-popover {
    position: fixed;
    z-index: 80;
    top: 50%;
    left: 50%;
    width: min(860px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(37, 48, 62, .2);
    transform: translate(-50%, -50%);
}
.interface-edit-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.interface-edit-header strong { color: #303841; font-size: 16px; }
.interface-list-panel .table-wrap:has(.interface-edit[open]) { overflow: visible; }
.interface-form.compact { grid-template-columns: repeat(4, minmax(130px, 1fr)); }

/* Shared page content used by the remaining original business modules */

.page-heading {
    display: flex;
    min-width: 0;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(54, 74, 99, .05);
}
.page-heading h1 { margin-bottom: 5px; font-size: 24px; }
.page-heading p { margin-bottom: 0; color: var(--muted); }
.eyebrow { margin-bottom: 3px; color: #7e8df0; font-size: 12px; }
.panel { padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-heading h2 { margin: 0; font-size: 18px; }
.panel-heading p { margin: 0; }

.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.content-grid-wide { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.metric-grid strong { display: block; margin: 4px 0; font-size: 25px; }
.metric-grid p,
.metric-grid small { margin: 0; color: var(--muted); }
.metric-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 7px; background: #eef2ff; color: var(--primary); }

.button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 7px;
}
.button-primary { color: #fff; background: var(--primary); }
.button-secondary { color: #59616a; border-color: #d8dde5; background: #fff; }
.button-ghost { color: #6574dd; border-color: #bac3f7; background: #fff; }
.button-danger { color: #b4495b; border-color: #efc5cc; background: #fff5f6; }
.button-sm { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.button-block { width: 100%; }

.badge {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    padding: 2px 7px;
    border-radius: 5px;
    color: #68717a;
    background: #eef1f5;
    font-size: 12px;
    white-space: nowrap;
}
.badge-online,
.badge-active,
.badge-paid,
.badge-approved,
.badge-used { color: #258461; background: #e8f7f1; }
.badge-pending,
.badge-warning,
.badge-maintenance,
.badge-reselect_required { color: #9b6a14; background: #fff4db; }
.badge-paused,
.badge-suspended,
.badge-rejected,
.badge-failed,
.badge-cancelled,
.badge-expired,
.badge-critical { color: #b4495b; background: #fdecef; }
.badge-neutral,
.badge-disabled,
.badge-unused { color: #68717a; background: #eef1f5; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th,
td { padding: 12px 11px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #767e87; font-size: 12px; font-weight: 600; background: #fafbfc; }
td { color: #555c64; }
.table-subtext { display: block; margin-top: 2px; color: #9299a1; font-size: 11px; }
.align-right { text-align: right; }
.empty-cell,
.empty-inline { padding: 28px; color: var(--muted); text-align: center; }
.inline-action { display: inline-flex; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.qq-list-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.qq-list-search { display: grid; grid-template-columns: minmax(210px, 1fr) 120px auto 92px; align-items: center; gap: 8px; }
.qq-list-search input,
.qq-list-search select { min-width: 0; }
.qq-batch-form { display: flex; align-items: center; gap: 8px; }
.qq-bulk-tools { position: relative; }
.qq-bulk-tools > summary { list-style: none; }
.qq-bulk-tools > summary::-webkit-details-marker { display: none; }
.qq-bulk-popover {
    position: absolute;
    z-index: 70;
    top: 46px;
    right: 0;
    width: min(340px, 84vw);
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(37, 48, 62, .2);
}
.qq-bulk-popover > strong { display: block; margin-bottom: 10px; }
.qq-duration-controls { display: grid; grid-template-columns: 1fr 1fr 80px; gap: 8px; margin-bottom: 10px; }
.qq-list-table { min-width: 980px; }
.qq-list-table input[type="checkbox"] { width: 16px; min-width: 16px; height: 16px; min-height: 16px; margin: 0; padding: 0; accent-color: var(--primary); }
.qq-inline-link { display: grid; gap: 2px; color: #6475df; white-space: nowrap; cursor: pointer; }
.qq-inline-link small { color: var(--muted); font-size: 11px; }
.qq-inline-link.is-expired { color: #cf596e; }
.qq-cell-editor > summary { list-style: none; }
.qq-cell-editor > summary::-webkit-details-marker { display: none; }
.qq-list-panel .table-wrap:has(.qq-cell-editor[open]) { overflow: visible; }
.table-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; color: var(--muted); }
.table-pagination > div { display: flex; gap: 8px; }
.row-editor { position: relative; text-align: left; }
.row-editor > summary { list-style: none; }
.row-editor > summary::-webkit-details-marker { display: none; }
.row-editor-popover {
    position: absolute;
    z-index: 65;
    top: 38px;
    right: 0;
    width: min(330px, 78vw);
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(37, 48, 62, .2);
}
.row-popover-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: -2px 0 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.row-popover-header .icon-button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: #5b6571;
    background: #f8fafc;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.row-popover-header .icon-button:hover { color: #d84b4b; background: #fff2f2; }
.money-editor[open]::before,
.user-edit-modal[open]::before,
.level-edit-modal[open]::before {
    content: "";
    position: fixed;
    z-index: 118;
    inset: 0;
    background: rgba(21, 28, 36, .42);
}
.money-editor .row-editor-popover,
.user-edit-modal .row-editor-popover,
.level-edit-modal .row-editor-popover {
    position: fixed;
    z-index: 119;
    top: 50%;
    left: 50%;
    right: auto;
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    transform: translate(-50%, -50%);
}
.user-edit-modal .row-editor-popover { width: min(520px, calc(100vw - 32px)); }
.level-edit-modal .row-editor-popover { width: min(520px, calc(100vw - 32px)); }
.money-editor .modal-title-inline,
.user-edit-modal .modal-title-inline,
.level-edit-modal .modal-title-inline {
    display: block;
    margin: 0 0 12px;
    color: #303841;
    font-size: 16px;
}
.balance-adjust-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

.search-form,
.inline-form,
.review-form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.search-form input { min-width: 220px; }
.stack-form { display: grid; gap: 14px; }
.stack-form label { display: grid; gap: 6px; }
.stack-form input,
.stack-form select,
.stack-form textarea { width: 100%; }
.form-panel { margin-bottom: 18px; }
.inline-form-four { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; }
.inline-form-four label { display: grid; gap: 6px; }

.inline-form-product {
    display: grid;
    grid-template-columns: repeat(6, minmax(105px, 1fr)) minmax(190px, 1.7fr) auto;
    align-items: end;
}
.inline-form-product label,
.editable-row label { display: grid; gap: 6px; }
.form-grow { min-width: 0; }
.editable-list { display: grid; gap: 12px; }
.editable-row {
    display: grid;
    grid-template-columns: 1.1fr repeat(5, minmax(90px, .65fr)) minmax(180px, 1.5fr) auto;
    align-items: end;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
}
.field-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(220px, .5fr);
    gap: 14px;
}
.field-row label { display: grid; gap: 6px; }
.field-row-actions { grid-template-columns: minmax(180px, .5fr) minmax(160px, 1fr) auto; align-items: end; }
.check-field {
    display: flex !important;
    min-height: 42px;
    align-items: center;
    flex-direction: row;
    gap: 8px !important;
}
.check-field input { width: 18px; min-height: 18px; height: 18px; }
.settings-section {
    display: grid;
    grid-template-columns: minmax(180px, .38fr) minmax(0, 1fr);
    gap: 24px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}
.settings-section:first-child { padding-top: 0; }
.settings-section h2 { margin-bottom: 5px; font-size: 17px; }
.settings-section p { margin: 0; color: var(--muted); }
.settings-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
.generated-panel textarea { width: 100%; resize: vertical; font-family: Consolas, monospace; }
.catalog-sections { display: grid; min-width: 0; gap: 18px; }
.catalog-sections > .panel { min-width: 0; }
.catalog-create {
    display: grid;
    align-items: end;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.catalog-create label { display: grid; gap: 6px; }
.catalog-create input,
.catalog-create select { width: 100%; min-width: 0; }
.category-create { grid-template-columns: minmax(0, 34fr) minmax(0, 18fr) minmax(0, 15fr) minmax(0, 19fr) minmax(0, 14fr); }
.protocol-create { grid-template-columns: minmax(0, 17fr) minmax(0, 17fr) minmax(0, 25fr) minmax(0, 12fr) minmax(0, 17fr) minmax(0, 12fr); }
.protocol-batch-form {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.protocol-batch-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 120px 120px 140px;
    align-items: end;
    gap: 10px;
}
.protocol-batch-toolbar label { display: grid; min-width: 0; gap: 6px; }
.protocol-batch-toolbar input { width: 100%; min-width: 0; }
.protocol-batch-wrap { margin: 0; }
.protocol-batch-table { min-width: 560px; table-layout: fixed; }
.protocol-batch-table th,
.protocol-batch-table td { padding: 7px 8px; }
.protocol-batch-table th:nth-child(1) { width: 28%; }
.protocol-batch-table th:nth-child(2) { width: 60%; }
.protocol-batch-table th:nth-child(3) { width: 12%; }
.protocol-batch-table input { width: 100%; min-height: 34px; padding: 5px 8px; border-radius: 5px; }
.protocol-batch-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.protocol-groups { display: grid; gap: 8px; }
.protocol-group { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; }
.protocol-group > summary { display: flex; min-height: 40px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; list-style: none; color: #4f5862; background: #f8f9fb; cursor: pointer; }
.protocol-group > summary::-webkit-details-marker { display: none; }
.protocol-group > summary small { color: var(--muted); }
.protocol-group[open] > summary { border-bottom: 1px solid var(--line); }
.protocol-group-table { min-width: 660px; table-layout: fixed; }
.protocol-group-table th:nth-child(1) { width: 18%; }
.protocol-group-table th:nth-child(2) { width: 34%; }
.protocol-group-table th:nth-child(3) { width: 14%; }
.protocol-group-table th:nth-child(4) { width: 18%; }
.protocol-group-table th:nth-child(5) { width: 16%; }
.icon-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    place-items: center;
    border: 1px solid #efc5cc;
    border-radius: 6px;
    color: #b4495b;
    background: #fff5f6;
    font-size: 20px;
    line-height: 1;
}
.catalog-create > .button { width: 100%; }
.catalog-table-wrap { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; }
.catalog-table th,
.catalog-table td { padding: 7px 8px; }
.catalog-table input,
.catalog-table select { width: 100%; min-height: 34px; padding: 5px 8px; border-radius: 5px; }
.catalog-status-control { display: grid; min-width: 0; gap: 6px; }
.catalog-status-control > span { color: #5d6570; }
.status-switch {
    display: inline-flex !important;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    align-items: center;
    gap: 8px !important;
    padding: 5px 9px;
    border: 1px solid #dfe3e9;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
}
.status-switch input[type="checkbox"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    accent-color: var(--primary);
}
.status-switch .status-on { color: #258461; }
.status-switch .status-off { display: none; color: #8a5d65; }
.status-switch input:not(:checked) ~ .status-on { display: none; }
.status-switch input:not(:checked) ~ .status-off { display: inline; }
.catalog-table .button { min-height: 34px; }
.category-table { min-width: 700px; table-layout: fixed; }
.category-table th:nth-child(1) { width: 34%; }
.category-table th:nth-child(2) { width: 18%; }
.category-table th:nth-child(3) { width: 15%; }
.category-table th:nth-child(4) { width: 19%; }
.category-table th:nth-child(5) { width: 14%; }
.protocol-table { min-width: 820px; table-layout: fixed; }
.protocol-table th:nth-child(1),
.protocol-table th:nth-child(2) { width: 17%; }
.protocol-table th:nth-child(3) { width: 25%; }
.protocol-table th:nth-child(4) { width: 12%; }
.protocol-table th:nth-child(5) { width: 17%; }
.protocol-table th:nth-child(6) { width: 12%; }
.catalog-row-form { display: inline-flex; }
.compact-table-wrap { max-width: 100%; }
.compact-edit-table { table-layout: fixed; }
.compact-edit-table th,
.compact-edit-table td { padding: 7px 8px; }
.compact-edit-table input,
.compact-edit-table select {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 5px 8px;
    border-radius: 5px;
}
.compact-edit-table .button { min-height: 34px; }
.level-table { min-width: 820px; }
.level-table th:nth-child(1),
.level-table th:nth-child(2) { width: 17%; }
.level-table th:nth-child(3),
.level-table th:nth-child(4) { width: 15%; }
.level-table th:nth-child(5) { width: 11%; }
.level-table th:nth-child(6) { width: 15%; }
.level-table th:nth-child(7) { width: 10%; }
.product-edit-table { min-width: 940px; }
.product-edit-table th:nth-child(1) { width: 15%; }
.product-edit-table th:nth-child(2),
.product-edit-table th:nth-child(3),
.product-edit-table th:nth-child(4),
.product-edit-table th:nth-child(5) { width: 10%; }
.product-edit-table th:nth-child(6) { width: 13%; }
.product-edit-table th:nth-child(7) { width: 23%; }
.product-edit-table th:nth-child(8) { width: 9%; }
.notification-table { min-width: 980px; }
.notification-table th:nth-child(1),
.notification-table th:nth-child(2),
.notification-table th:nth-child(3) { width: 10%; }
.notification-table th:nth-child(4) { width: 15%; }
.notification-table th:nth-child(5) { width: 17%; }
.notification-table th:nth-child(6) { width: 12%; }
.notification-table th:nth-child(7) { width: 8%; }
.notification-table th:nth-child(8) { width: 10%; }
.notification-table th:nth-child(9) { width: 8%; }
.level-create { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto; align-items: end; }
.level-create label { display: grid; gap: 6px; }
.level-row { grid-template-columns: repeat(6, minmax(0, 1fr)) auto; }
.integration-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }
.integration-form label { display: grid; gap: 6px; }
.integration-form .span-full { grid-column: 1 / -1; }
.payment-channel-row { grid-template-columns: repeat(8, minmax(95px, 1fr)) minmax(180px, 1.5fr) auto; }
.payment-settings-form { display: grid; gap: 18px; }
.payment-method-list { border-top: 1px solid var(--line); }
.payment-method-list > label {
    display: grid;
    grid-template-columns: minmax(170px, .35fr) minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.payment-method-list > label > span { font-weight: 600; }
.payment-provider-group {
    min-width: 0;
    margin: 0;
    padding: 16px 0 0;
    border: 0;
    border-top: 1px solid var(--line);
}
.payment-provider-group legend { padding: 0 12px 0 0; font-size: 16px; font-weight: 700; }
.payment-config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.payment-config-grid label { display: grid; min-width: 0; gap: 6px; }
.payment-config-grid .span-full { grid-column: 1 / -1; }
.payment-config-grid textarea { width: 100%; resize: vertical; font-family: Consolas, monospace; }
.payment-config-grid small { color: var(--muted); }
.interface-endpoint-table { min-width: 940px; }
.interface-endpoint-table code { white-space: nowrap; }
.payment-redirect-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: #f4f6f8; }
.payment-redirect-panel { width: min(520px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: center; }
.payment-redirect-panel h1 { font-size: 24px; }
.payment-redirect-panel form { margin-top: 20px; }
.payment-qr-panel canvas { display: block; width: 240px; height: 240px; max-width: 100%; margin: 16px auto; }
.payment-amount { margin: 8px 0; font-size: 28px; font-weight: 700; }
.payment-order-no { color: var(--muted); font-family: Consolas, monospace; }
.wallet-actions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.task-create { display: grid; grid-template-columns: 1.2fr 1.4fr .8fr .8fr auto; align-items: end; }
.task-create label { display: grid; gap: 6px; }
.notification-channel-row { grid-template-columns: repeat(8, minmax(100px, 1fr)) auto; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-card { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.product-card h2,
.product-card h3 { font-size: 18px; }
.product-card p,
.product-card li { color: var(--muted); }
.product-card .price strong { font-size: 25px; }

.article-list,
.message-stack { display: grid; gap: 10px; }
.article-list a,
.message-stack article { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.article-list small,
.message-stack small { display: block; color: var(--muted); }
.article-list time { margin-left: auto; color: var(--muted); }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-top: 18px; }
.quick-actions a { display: flex; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.quick-actions small { display: block; color: var(--muted); }
.balance-chip,
.limit-indicator { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }

@media (max-width: 1180px) {
    .admin-shell { grid-template-columns: 220px minmax(0, 1fr); gap: 22px; padding: 20px 24px 32px; }
    .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    .ws-config-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .qq-card-grid { gap: 18px; }
    .inline-form-product,
    .editable-row,
    .level-create,
    .level-row,
    .payment-channel-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .category-create,
    .protocol-create { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .notification-channel-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .wallet-actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .notification-channel-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .task-create { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .inline-form-product .form-grow,
    .editable-row .form-grow { grid-column: span 2; }
}

@media (max-width: 900px) {
    .admin-license-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
    .license-client-layout { grid-template-columns: 1fr; }
    .qq-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-chart-grid,
    .content-grid,
    .content-grid-wide,
    .add-qq-grid { grid-template-columns: 1fr; }
    .metric-grid,
    .product-grid,
    .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inline-form-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .interface-form,
    .interface-form.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .interface-form .span-4 { grid-column: 1 / -1; }
    .inline-form-product,
    .editable-row,
    .level-create,
    .level-row,
    .integration-form,
    .payment-channel-row,
    .wallet-actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .payment-config-grid { grid-template-columns: 1fr; }
    .payment-config-grid .span-full { grid-column: auto; }
    .category-create,
    .protocol-create { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .protocol-batch-toolbar { grid-template-columns: minmax(0, 1fr) minmax(90px, .45fr); }
    .protocol-batch-toolbar > :first-child { grid-column: 1 / -1; }
    .protocol-batch-toolbar > .button { grid-column: 1 / -1; }
    .task-create { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inline-form-product .form-grow,
    .editable-row .form-grow { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .portal-content { padding-top: 28px; }
    .portal-content h1 { font-size: 31px; }
    .portal-avatar { width: 82px; height: 82px; }

    .user-shell { width: 100%; margin: 0; padding: 80px 12px 82px; }
    .user-page-header {
        position: fixed;
        z-index: 90;
        top: 0;
        left: 0;
        width: 100%;
        min-height: 70px;
        padding: 10px 16px;
        border-radius: 0;
    }
    .user-page-header h1 { margin: 0; font-size: 25px; }
    .user-page-header p { display: none; }
    .user-tabs {
        position: fixed;
        z-index: 90;
        right: 0;
        bottom: 0;
        left: 0;
        min-height: 66px;
        margin: 0;
        padding: 10px 24px 16px;
        border-radius: 0;
        justify-content: space-around;
    }
    .qq-card-grid { grid-template-columns: 1fr; }
    .qq-card { max-width: 460px; width: 100%; margin: 0 auto; }
    .form-row { grid-template-columns: 1fr; gap: 5px; }
    .form-actions-row > span { display: none; }
    .account-banner { align-items: flex-start; gap: 14px; padding: 14px; }
    .account-banner img { width: 82px; height: 82px; }
    .account-banner h2,
    .account-banner p { font-size: 14px; }

    .admin-shell { display: block; padding: 12px; }
    .admin-topbar { position: sticky; z-index: 70; top: 8px; min-height: 62px; padding: 0 12px; }
    .admin-topbar nav { display: none; }
    .admin-sidebar {
        position: fixed;
        z-index: 80;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(285px, 86vw);
        overflow-y: auto;
        border-radius: 0;
        transform: translateX(-105%);
        transition: transform .2s ease;
    }
    .sidebar-open .admin-sidebar { transform: translateX(0); }
    .admin-main { margin-top: 16px; }
    .admin-license-panel { padding: 16px; }
    .admin-license-meta { grid-template-columns: 1fr; gap: 8px; }
    .license-form-section { grid-template-columns: 1fr; padding: 14px; }
    .license-switch-row { grid-template-columns: 1fr; gap: 10px; }
    .license-client-actions { flex-direction: column; }
    .license-client-actions .button { width: 100%; }
    .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
    .admin-stat-grid article { min-height: 96px; padding: 12px; }
    .admin-stat-grid h2 { margin-bottom: 8px; font-size: 15px; }
    .admin-stat-grid p { padding-right: 42px; font-size: 12px; line-height: 1.35; }
    .admin-stat-grid strong { right: 12px; bottom: 10px; font-size: 23px; }
    .admin-chart-grid { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
    .ws-config-row { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
    .ws-config-row > input:not([type="hidden"]) { grid-column: span 3; min-width: 0; }
    .ws-config-row > select { grid-column: 1 / -1; }
    .ws-config-row > .soft-button { grid-column: span 2; min-width: 0; min-height: 38px; padding: 6px 4px; font-size: 12px; }
    .page-heading { align-items: stretch; flex-direction: column; gap: 10px; padding: 12px 14px; }
    .search-form input { min-width: 0; width: 100%; }
    .qq-list-toolbar { align-items: stretch; }
    .qq-list-search { width: 100%; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .qq-list-search input { grid-column: 1 / -1; }
    .qq-list-search .button,
    .qq-list-search select { width: 100%; }
    .qq-batch-form { width: 100%; }
    .qq-batch-form > * { flex: 1; }
    .qq-batch-form .button { width: 100%; }
    .qq-bulk-popover { position: fixed; z-index: 100; inset: 76px 12px auto; width: auto; }
    .qq-list-panel .table-wrap:has(.qq-cell-editor[open]) { overflow-x: auto; }
    .qq-cell-editor .row-editor-popover { position: fixed; z-index: 100; inset: 76px 12px auto; width: auto; }
    .metric-grid,
    .product-grid,
    .quick-actions,
    .inline-form-four { grid-template-columns: 1fr; }
    .interface-form,
    .interface-form.compact { grid-template-columns: 1fr; }
    .interface-form .span-2,
    .interface-form .span-4 { grid-column: auto; }
    .inline-form-product,
    .editable-row,
    .catalog-create,
    .level-create,
    .level-row,
    .integration-form,
    .payment-channel-row,
    .wallet-actions-grid,
    .task-create,
    .notification-channel-row,
    .field-row,
    .field-row-actions,
    .settings-section { grid-template-columns: 1fr; }
    .payment-method-list > label { grid-template-columns: 1fr; gap: 7px; }
    .inline-form-product .form-grow,
    .editable-row .form-grow { grid-column: auto; }
    .integration-form .span-full { grid-column: auto; }
    .interface-edit-popover {
        inset: 76px 12px 12px;
        width: auto;
        max-height: none;
        overflow-y: auto;
        transform: none;
    }
    .interface-list-panel .table-wrap:has(.interface-edit[open]) { overflow-x: auto; }
    .protocol-batch-toolbar { grid-template-columns: minmax(0, 1fr) minmax(90px, .45fr); }
    .protocol-batch-toolbar > :first-child { grid-column: 1 / -1; }
    .protocol-batch-toolbar > .button { grid-column: 1 / -1; }
    .protocol-batch-actions .button { min-width: 0; flex: 1; padding-right: 8px; padding-left: 8px; }
}

@media (max-width: 480px) {
    .portal-content { min-height: calc(100svh - 95px); width: calc(100% - 28px); }
    .portal-content h1 { font-size: 28px; }
    .portal-content p { font-size: 13px; }
    .portal-actions { width: min(250px, 88vw); }
    .portal-footer { bottom: 14px; }
    .user-toolbar { gap: 4px; }
    .outline-button { padding-right: 9px; padding-left: 9px; }
    .qq-card-header { padding: 12px 16px; }
    .qq-card-header > img { width: 62px; height: 62px; flex-basis: 62px; }
    .qq-card-body { padding: 15px 16px 18px; }
    .qq-status-row { flex-wrap: wrap; }
    .input-combo { grid-template-columns: minmax(0, 1fr) 108px; }
    .api-test-combo { grid-template-columns: minmax(0, 1fr) 108px; }
    .api-test-combo .button { padding-right: 7px; padding-left: 7px; }
    .account-meta-controls { grid-template-columns: minmax(0, 1fr) auto 106px; gap: 6px; }
    .login-flow-inline,
    .login-flow-grid { grid-template-columns: 1fr; }
    .account-banner { margin-right: 0; margin-left: 0; }
    .account-banner img { width: 72px; height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
