:root {
    color-scheme: light;
    --bg: #f5f7f9;
    --ink: #1f2933;
    --muted: #667789;
    --line: #d9e1e8;
    --panel: #ffffff;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --green: #138a5b;
    --green-bg: #def7ec;
    --red: #b42318;
    --red-bg: #fee4e2;
    --amber: #936514;
    --amber-bg: #fff3c4;
    --gray-bg: #edf1f5;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 14px;
}

.topbar {
    min-height: 84px;
    padding: 18px clamp(16px, 4vw, 40px);
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 24px;
    font-weight: 700;
}

h2 {
    font-size: 16px;
}

.topbar p,
.muted {
    color: var(--muted);
}

main {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 22px clamp(16px, 4vw, 40px) 48px;
}

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

.metrics div,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metrics div {
    padding: 16px;
}

.metrics span {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

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

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

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

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

.add-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 10px;
    margin-bottom: 16px;
}

textarea,
input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    color: var(--ink);
    background: #fff;
    outline: none;
}

textarea:focus,
input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    white-space: nowrap;
}

button:hover {
    border-color: #a8b4c2;
}

button.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

button.primary:hover {
    background: var(--blue-dark);
}

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

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

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

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

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 250px;
}

.inline {
    display: inline;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    white-space: nowrap;
}

.check input {
    width: auto;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-available {
    color: var(--green);
    background: var(--green-bg);
}

.status-registered {
    color: #314050;
    background: var(--gray-bg);
}

.status-error {
    color: var(--red);
    background: var(--red-bg);
}

.status-rate_limited {
    color: var(--red);
    background: var(--red-bg);
}

.status-unknown {
    color: var(--amber);
    background: var(--amber-bg);
}

.settings-form {
    display: grid;
    gap: 12px;
}

.settings-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
}

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

.flash {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: #fff;
}

.flash.ok {
    border-color: #a6e3c5;
    background: #ecfdf3;
}

.flash.warn {
    border-color: #f5d56a;
    background: #fffbeb;
}

.flash.error {
    border-color: #fda29b;
    background: #fff1f0;
}

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

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

@media (max-width: 640px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

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

.public-page {
    background: #f7f9fc;
}

.public-header {
    height: 72px;
    padding: 0 clamp(20px, 6vw, 84px);
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-actions form {
    margin: 0;
}

.auth-page {
    max-width: 980px;
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.auth-grid .credential-form {
    width: auto;
    margin: 0;
}

.brand {
    color: var(--ink);
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.admin-link {
    color: var(--muted);
    text-decoration: none;
}

.public-main {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 42px clamp(20px, 5vw, 72px) 72px;
}

.public-hero {
    min-height: 430px;
    padding: clamp(28px, 6vw, 74px);
    border-radius: 10px;
    background: #102a43;
    color: #ffffff;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: center;
    gap: 48px;
}

.eyebrow {
    display: block;
    margin-bottom: 12px;
    color: #3b82f6;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.public-hero .eyebrow {
    color: #8bb9ff;
}

.hero-copy h1 {
    max-width: 650px;
    margin: 0 0 18px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.12;
}

.hero-copy p {
    max-width: 620px;
    color: #d9e5f2;
    font-size: 17px;
    line-height: 1.75;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.primary-link,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 6px;
    text-decoration: none;
}

.primary-link {
    background: #3b82f6;
    color: #ffffff;
}

.secondary-link {
    border: 1px solid #6f8bab;
    color: #ffffff;
}

.availability {
    padding: 28px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.availability-label,
.availability-note {
    display: block;
    color: #d9e5f2;
}

.availability strong {
    display: block;
    margin: 8px 0;
    font-size: 78px;
    line-height: 1;
}

.availability-note {
    font-size: 13px;
    line-height: 1.6;
}

.public-section {
    padding: 76px 0 0;
}

.section-heading h2 {
    margin: 0 0 12px;
    font-size: 30px;
}

.section-heading p {
    color: var(--muted);
    line-height: 1.7;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.steps article {
    min-height: 190px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.steps span {
    color: #3b82f6;
    font-weight: 700;
}

.steps h3 {
    margin: 22px 0 10px;
    font-size: 18px;
}

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

.authorize-section {
    min-height: 300px;
    text-align: center;
}

.authorize-section .section-heading {
    max-width: 620px;
    margin: 0 auto;
}

.bot-qr {
    display: block;
    width: 180px;
    height: 180px;
    margin: 26px auto;
    object-fit: contain;
    border: 1px solid var(--line);
    background: #ffffff;
}

.is-hidden {
    display: none !important;
}

.setup-note,
.setup-banner {
    max-width: 620px;
    margin: 24px auto;
    padding: 16px;
    border: 1px solid #f2d38b;
    border-radius: 8px;
    background: #fff9e8;
    color: #7a5a18;
}

.privacy-note {
    color: var(--muted);
    font-size: 13px;
}

.public-footer {
    padding: 28px 20px 40px;
    color: var(--muted);
    text-align: center;
}

.binding-code {
    display: grid;
    gap: 6px;
    justify-items: center;
    max-width: 360px;
    margin: 24px auto 12px;
    padding: 20px;
    border: 1px solid var(--line);
    background: #fff;
}

.binding-code strong {
    color: var(--blue);
    font: 700 32px/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 4px;
}

.binding-code small,
.bind-instruction {
    color: var(--muted);
}

.credential-form {
    width: min(620px, 100%);
    display: grid;
    gap: 12px;
    margin: 28px auto 16px;
    padding: 22px;
    text-align: left;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.credential-form h3 {
    margin: 0;
    font-size: 18px;
}

.credential-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
}

.setup-note.ok {
    border-color: #a6e3c5;
    background: #ecfdf3;
    color: var(--green);
}

.setup-note.error {
    border-color: #fda29b;
    background: #fff1f0;
    color: var(--red);
}

.payment-result {
    width: min(520px, calc(100% - 32px));
    margin: 12vh auto;
    padding: 44px 28px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: center;
}

.payment-result h1 {
    margin: 16px 0 8px;
}

.payment-result p {
    margin-bottom: 24px;
    color: var(--muted);
}

.result-mark {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--green-bg);
    color: var(--green);
    font-size: 34px;
    line-height: 56px;
}

.settings-form hr {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
    .public-header {
        height: auto;
        min-height: 72px;
        padding-top: 14px;
        padding-bottom: 14px;
        align-items: flex-start;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

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

    .public-hero {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .availability {
        padding: 24px 0 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        border-left: 0;
    }

    .availability strong {
        font-size: 60px;
    }

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

/* Admin console */
.admin-shell {
    --admin-ink: #172033;
    --admin-muted: #718096;
    --admin-line: #e5eaf0;
    --admin-soft: #f6f8fb;
    background: #f4f6f8;
    color: var(--admin-ink);
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.admin-layout {
    display: block;
    height: 100vh;
    min-height: 0;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 236px;
    min-width: 236px;
    height: 100vh;
    min-height: 0;
    padding: 26px 16px 20px;
    background: #111827;
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 20;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 10px 28px;
}

.admin-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #3b82f6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

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

.admin-brand strong {
    font-size: 15px;
}

.admin-brand small {
    margin-top: 3px;
    color: #9ca9ba;
    font-size: 11px;
}

.admin-nav {
    display: grid;
    gap: 5px;
}

.admin-nav a {
    min-height: 42px;
    padding: 0 12px;
    border-radius: 7px;
    color: #aeb9c8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background .15s ease, color .15s ease;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: #fff;
    background: #26354a;
}

.admin-nav a.active {
    box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .75;
}

.admin-sidebar-foot {
    margin-top: auto;
    padding: 16px 12px 0;
    border-top: 1px solid #293548;
    color: #8491a3;
    font-size: 12px;
}

.admin-sidebar-foot strong {
    display: block;
    margin-top: 6px;
    color: #d9e3f0;
    font-size: 13px;
}

.admin-main {
    min-width: 0;
    height: 100vh;
    margin-left: 236px;
    overflow-y: auto;
}

.admin-topbar {
    min-height: 92px;
    padding: 22px 34px;
    background: #fff;
    border-bottom: 1px solid var(--admin-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.admin-topbar h1 {
    margin: 5px 0 0;
    font-size: 23px;
}

.admin-kicker {
    color: #66809e;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.admin-content {
    width: min(1560px, 100%);
    margin: 0 auto;
    padding: 28px 34px 56px;
}

.admin-flash {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--admin-line);
    border-radius: 7px;
    background: #fff;
}

.admin-flash.ok {
    border-color: #a7dfc0;
    background: #effcf4;
    color: #176c49;
}

.admin-flash.warn {
    border-color: #eed58a;
    background: #fffaf0;
    color: #876217;
}

.admin-flash.error {
    border-color: #f2b6b0;
    background: #fff4f3;
    color: #a22b20;
}

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

.metric-card,
.admin-panel {
    border: 1px solid var(--admin-line);
    background: #fff;
    border-radius: 8px;
}

.metric-card {
    min-height: 132px;
    padding: 19px 20px;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    font-size: 31px;
    line-height: 1;
}

.metric-card small,
.metric-label,
.section-meta {
    color: var(--admin-muted);
}

.metric-card small {
    display: block;
    margin-top: 12px;
    font-size: 12px;
}

.metric-green strong {
    color: #16845a;
}

.metric-gray strong {
    color: #5b6879;
}

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

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

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

.section-title {
    min-height: 35px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.section-title h2 {
    margin-top: 4px;
    font-size: 18px;
}

.review-status-panel {
    padding-top: 18px;
}

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

.review-status-card {
    min-height: 118px;
    padding: 15px;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    background: #fbfcfe;
}

.review-status-card.is-active {
    border-color: #9fc7ff;
    background: #f4f8ff;
}

.review-status-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.review-status-head strong {
    font-size: 14px;
}

.review-status-head em {
    margin-left: auto;
    color: var(--admin-muted);
    font-size: 12px;
    font-style: normal;
}

.review-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 99px;
    background: #aab4c2;
    flex: 0 0 auto;
}

.review-status-card.is-active .review-status-dot {
    background: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.review-status-domain {
    margin-top: 12px;
    color: var(--admin-ink);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-all;
}

.review-status-meta,
.review-status-message {
    margin-top: 7px;
    color: var(--admin-muted);
    font-size: 12px;
    line-height: 1.45;
}

.review-status-recent-item {
    display: block;
    padding: 2px 0;
    word-break: break-all;
}

.text-link {
    color: #2563eb;
    font-size: 13px;
    text-decoration: none;
}

.inventory-list {
    display: grid;
    gap: 4px;
}

.inventory-list a {
    min-height: 42px;
    padding: 0 5px;
    border-bottom: 1px solid #f0f2f5;
    color: var(--admin-ink);
    text-decoration: none;
    display: grid;
    grid-template-columns: 10px 1fr auto;
    align-items: center;
    gap: 10px;
}

.inventory-list a:last-child {
    border-bottom: 0;
}

.inventory-list strong {
    font-variant-numeric: tabular-nums;
}

.inventory-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.inventory-dot.green { background: #24a06b; }
.inventory-dot.blue { background: #3b82f6; }
.inventory-dot.amber { background: #d49a24; }
.inventory-dot.gray { background: #8793a3; }

.summary-list {
    margin: 0;
}

.summary-list div {
    min-height: 42px;
    padding: 0 0 0 2px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.summary-list div:last-child {
    border-bottom: 0;
}

.summary-list dt {
    color: var(--admin-muted);
}

.summary-list dd {
    margin: 0;
    font-weight: 600;
}

.notice-panel {
    display: flex;
    align-items: center;
    gap: 14px;
    border-color: #f1d999;
    background: #fffaf0;
}

.notice-panel span {
    color: #85651d;
}

.filter-bar {
    min-height: 42px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--admin-line);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.filter-bar a {
    padding: 10px 12px;
    border-bottom: 2px solid transparent;
    color: var(--admin-muted);
    text-decoration: none;
}

.filter-bar a.active {
    border-color: #2563eb;
    color: #2563eb;
    font-weight: 600;
}

.filter-select {
    margin-left: auto;
}

select,
.table-input {
    min-height: 36px;
    border: 1px solid var(--admin-line);
    border-radius: 6px;
    background: #fff;
    color: var(--admin-ink);
    padding: 7px 9px;
}

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

.add-domain-card {
    padding: 16px;
    border: 1px solid var(--admin-line);
    border-radius: 7px;
    background: var(--admin-soft);
    display: grid;
    gap: 10px;
}

.add-domain-card strong,
.add-domain-card small {
    display: block;
}

.add-domain-card small {
    margin-top: 4px;
    color: var(--admin-muted);
}

.add-domain-card textarea {
    border-color: var(--admin-line);
    resize: vertical;
}

.button {
    min-height: 36px;
    padding: 7px 13px;
    border: 1px solid #d4dce6;
    border-radius: 6px;
    background: #fff;
    color: var(--admin-ink);
    cursor: pointer;
    white-space: nowrap;
}

.button:hover {
    border-color: #9caec2;
}

.button-primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.button-primary:hover {
    border-color: #1d4ed8;
    background: #1d4ed8;
}

.button-danger {
    border-color: #f0c4bf;
    color: #b42318;
}

.button-small {
    min-height: 31px;
    padding: 5px 9px;
    font-size: 12px;
}

.save-domain-settings.is-dirty {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

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

.table-toolbar > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

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

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

.admin-table th {
    color: var(--admin-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background: #fbfcfe;
}

.check-col {
    width: 40px;
    text-align: center !important;
}

.domain-name-input {
    width: 170px;
}

.price-input {
    width: 104px;
}

.config-details {
    margin-top: 6px;
    max-width: 260px;
}

.config-details summary {
    cursor: pointer;
    color: #2563eb;
    font-size: 12px;
}

.config-details label {
    display: block;
    margin-top: 6px;
    color: var(--admin-muted);
    font-size: 11px;
}

.config-input {
    display: block;
    width: 240px;
    max-width: 100%;
    margin-top: 3px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
}

.row-note {
    display: block;
    margin-top: 5px;
    color: #a06e17;
    font-size: 11px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-available {
    color: #12744d;
    background: #ddf7e9;
}

.status-registered {
    color: #3d4a5a;
    background: #edf1f5;
}

.status-cleared {
    color: #8a641d;
    background: #fff3cf;
}

.status-long_term_unavailable {
    color: #8a641d;
    background: #fff3cf;
}

.status-sold {
    color: #6646a6;
    background: #eee7fb;
}

.status-error,
.status-rate_limited {
    color: #ab2a20;
    background: #fee8e6;
}

.status-unknown {
    color: #88641b;
    background: #fff4d1;
}

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

.table-actions {
    min-width: 285px;
}

.table-actions form {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 2px 4px 2px 0;
}

.table-actions select {
    min-height: 31px;
    padding: 4px 6px;
    font-size: 12px;
}

.switch-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--admin-muted);
    font-size: 12px;
    white-space: nowrap;
}

.detection-switches {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    margin: 2px 5px 2px 0;
}

.empty-cell {
    padding: 42px 12px !important;
    color: var(--admin-muted);
    text-align: center !important;
}

.settings-panel {
    max-width: 1120px;
}

.admin-settings-form {
    display: grid;
    gap: 4px;
}

.settings-section {
    padding: 20px 0;
    border-top: 1px solid var(--admin-line);
}

.settings-section h3 {
    margin: 0 0 15px;
    font-size: 14px;
}

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

.settings-grid label {
    display: grid;
    gap: 6px;
    color: var(--admin-muted);
    font-size: 13px;
}

.field-help {
    color: var(--admin-muted);
    font-size: 11px;
}

.api-test-row {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--admin-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--admin-muted);
}

.api-test-row > div {
    display: flex;
    gap: 8px;
}

.settings-grid input,
.settings-grid textarea,
.settings-grid select {
    width: 100%;
    border-color: var(--admin-line);
}

.wide-field {
    grid-column: 1 / -1;
}

.settings-submit {
    justify-self: start;
    margin-top: 15px;
}

.user-content .setup-note {
    max-width: none;
    margin: 0 0 18px;
}

.user-content .user-view[hidden] {
    display: none !important;
}

.user-content .public-hero {
    min-height: 300px;
    padding: 38px;
    border-radius: 8px;
}

.user-content .public-section {
    margin: 0 0 18px;
    padding: 22px;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    background: #fff;
}

.user-content .public-section.tutorial-section {
    padding-bottom: 26px;
}

.user-content .authorize-section {
    min-height: 0;
    text-align: left;
}

.user-content .authorize-section .section-heading {
    max-width: none;
    margin: 0;
}

.user-content .section-heading h2 {
    margin-bottom: 8px;
    font-size: 20px;
}

.user-content .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.user-content .steps article {
    min-height: 145px;
    padding: 18px;
}

.user-content .steps h3 {
    margin: 16px 0 8px;
    font-size: 16px;
}

.user-content .credential-form {
    width: min(720px, 100%);
    margin: 20px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.user-content .bot-qr {
    margin: 22px 0;
}

.user-content .binding-code {
    justify-items: start;
    margin: 22px 0 0;
}

.user-content .table-wrap {
    overflow-x: auto;
    margin-top: 18px;
    border: 1px solid var(--admin-line);
    border-radius: 7px;
}

.user-content .table-wrap table {
    min-width: 760px;
}

.user-content .setup-banner {
    max-width: none;
    margin: 0 0 18px;
}

.user-shell-page .admin-topbar .header-actions {
    color: var(--admin-muted);
}

@media (max-width: 1050px) {
    .admin-sidebar {
        width: 210px;
        min-width: 210px;
    }

    .admin-main {
        margin-left: 210px;
    }

    .admin-content,
    .admin-topbar {
        padding-left: 22px;
        padding-right: 22px;
    }

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

@media (max-width: 760px) {
    .admin-shell {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .admin-layout {
        display: block;
        height: auto;
        min-height: 0;
    }

    .admin-sidebar {
        position: static;
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: auto;
        padding: 16px;
        overflow: visible;
    }

    .admin-brand {
        padding-bottom: 15px;
    }

    .admin-nav {
        display: flex;
        overflow-x: auto;
        gap: 5px;
    }

    .admin-nav a {
        min-width: max-content;
        min-height: 36px;
    }

    .admin-sidebar-foot {
        display: none;
    }

    .admin-topbar {
        min-height: 78px;
        padding: 18px 16px;
    }

    .admin-main {
        height: auto;
        margin-left: 0;
        overflow: visible;
    }

    .admin-content {
        padding: 18px 16px 40px;
    }

    .admin-grid.two,
    .add-grid,
    .review-status-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .wide-field {
        grid-column: auto;
    }

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

    .user-content .public-hero {
        min-height: 0;
        padding: 26px;
    }

    .user-content .steps {
        grid-template-columns: 1fr;
    }

    .user-content .public-section {
        padding: 18px;
    }

    .filter-select {
        width: 100%;
        margin-left: 0;
    }

    .filter-select select {
        width: 100%;
    }
}
