/* 终端授权查询页 — 对齐 UXbot auth-query-home 设计 */
:root {
    --background: 220 8% 98%;
    --foreground: 220 15% 15%;
    --card: 0 0% 100%;
    --primary: 210 85% 50%;
    --primary-foreground: 0 0% 100%;
    --primary-hover: 210 85% 58%;
    --accent: 210 20% 92%;
    --accent-foreground: 210 85% 45%;
    --muted-foreground: 220 10% 55%;
    --destructive: 0 70% 50%;
    --border: 220 15% 88%;
    --input: 220 15% 88%;
    --ring: 210 85% 50%;
    --radius: 0.5rem;
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.08);
    --font-sans: "Inter", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.license-page {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    min-height: 100vh;
}

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

.license-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.license-header {
    height: 4rem;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    flex-shrink: 0;
}

.license-header-inner {
    max-width: 64rem;
    margin: 0 auto;
    height: 100%;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.license-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.license-brand-icon {
    width: 2rem;
    height: 2rem;
    border-radius: calc(var(--radius));
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    display: flex;
    align-items: center;
    justify-content: center;
}

.license-brand-text {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.license-hotline {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* 查询首页 — 1080 高度一屏展示 */
.license-page-home .license-header {
    height: 3rem;
}

.license-page-home .license-main {
    padding: 1rem 1.5rem 0.75rem;
    justify-content: flex-start;
}

.license-page-home .license-hero {
    margin-bottom: 0.875rem;
}

.license-page-home .license-hero h1 {
    font-size: 1.5rem;
    margin-bottom: 0.375rem;
}

.license-page-home .license-hero-desc {
    font-size: 0.8125rem;
    line-height: 1.45;
}

.license-page-home .license-form-card {
    padding: 1rem 1.125rem;
}

.license-page-home .license-form > * + * {
    margin-top: 0.625rem;
}

.license-page-home .license-field label {
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
}

.license-page-home .license-input {
    height: 2.125rem;
    font-size: 0.8125rem;
}

.license-page-home .field-hint {
    margin-top: 0.125rem;
    font-size: 0.6875rem;
    line-height: 1.3;
}

.license-page-home .license-form-actions {
    padding-top: 0.25rem;
}

.license-page-home .license-tip-box {
    padding: 0.5rem 0.625rem;
    font-size: 0.6875rem;
}

.license-page-home .license-guide-section {
    margin-top: 1rem;
    padding-top: 0.875rem;
}

.license-page-home .license-guide-grid {
    gap: 1.25rem;
}

.license-page-home .license-guide-section h3 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.license-page-home .license-steps,
.license-page-home .license-faq {
    gap: 0.375rem;
    font-size: 0.6875rem;
}

.license-page-home .license-contact {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

.license-page-home .license-contact p {
    font-size: 0.6875rem;
}

.license-page-home .license-contact-info {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.license-page-home .license-footer {
    padding: 0.75rem 1.5rem;
}

.license-page-home .license-footer-sub,
.license-page-home .license-footer-tag {
    display: none;
}

.license-page-home .license-footer-copy p {
    font-size: 0.75rem;
}

.license-main {
    flex: 1;
    max-width: 64rem;
    margin: 0 auto;
    width: 100%;
    padding: 3rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.license-hero {
    max-width: 42rem;
    width: 100%;
    text-align: center;
    margin-bottom: 3rem;
}

.license-hero h1 {
    font-size: clamp(1.875rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
}

.license-hero-desc {
    font-size: 1rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.6;
}

.license-form-card {
    width: 100%;
    max-width: 28rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
}

.license-form > * + * { margin-top: 1.25rem; }

.license-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.optional {
    font-size: 0.75rem;
    font-weight: 400;
    color: hsl(var(--muted-foreground));
}

.license-input {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--card));
    font-size: 0.875rem;
}

.license-input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.field-hint {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.375rem;
}

.license-form-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-primary {
    flex: 1;
    height: 2.5rem;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.btn-primary:hover { background: hsl(var(--primary-hover)); }

.btn-outline {
    height: 2.5rem;
    width: 2.5rem;
    padding: 0;
    background: transparent;
    border-color: hsl(var(--input));
    color: hsl(var(--foreground));
}

.btn-outline:hover {
    background: hsl(var(--accent));
}

.btn-ghost {
    background: transparent;
    border: none;
    color: hsl(var(--primary));
    padding: 0.25rem 0.5rem;
}

.btn-ghost:hover { background: hsl(var(--accent)); }

.btn-sm { font-size: 0.75rem; }

.license-tip-box {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.75rem;
    background: hsl(var(--accent) / 0.35);
    border: 1px solid hsl(var(--accent));
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.75rem;
    color: hsl(var(--foreground) / 0.85);
}

.license-tip-box svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: hsl(var(--primary));
}

.license-alert {
    padding: 0.75rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.license-alert-success {
    background: hsl(142 60% 95%);
    border: 1px solid hsl(142 50% 80%);
    color: hsl(142 50% 25%);
}

.license-alert-error {
    background: hsl(var(--destructive) / 0.08);
    border: 1px solid hsl(var(--destructive) / 0.25);
    color: hsl(var(--destructive));
}

.license-results {
    width: 100%;
    max-width: 56rem;
    margin-top: 2.5rem;
}

.license-results h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.license-results-table-wrap {
    overflow-x: auto;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
}

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

.license-table th,
.license-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    border-bottom: 1px solid hsl(var(--border));
}

.license-table th {
    background: hsl(var(--background));
    font-weight: 600;
}

.license-table tbody tr:last-child td { border-bottom: none; }

.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.muted { color: hsl(var(--muted-foreground)); }

.badge {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid hsl(var(--border));
}

.badge-bound {
    border-color: hsl(142 50% 70%);
    background: hsl(142 60% 95%);
    color: hsl(142 45% 30%);
}

.badge-muted {
    background: hsl(var(--background));
    color: hsl(var(--muted-foreground));
}

.license-guide-section {
    width: 100%;
    max-width: 42rem;
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid hsl(var(--border) / 0.5);
}

.license-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
}

.license-guide-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.license-steps,
.license-faq {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.license-steps li {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    background: hsl(var(--primary) / 0.1);
    color: hsl(var(--primary));
    font-size: 0.6875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.license-faq li {
    display: flex;
    gap: 0.5rem;
}

.license-faq .faq-a { margin-left: 1.5rem; }

.faq-q {
    color: hsl(var(--primary));
    font-weight: 600;
    flex-shrink: 0;
}

.license-contact {
    width: 100%;
    max-width: 42rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--border) / 0.5);
    text-align: center;
}

.license-contact p {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.license-contact-info {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--primary));
    margin-top: 0.5rem;
}

.license-admin-link {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
}

.license-footer {
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    padding: 2.5rem 1.5rem;
    flex-shrink: 0;
}

.license-footer-inner {
    max-width: 64rem;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.license-footer-copy p {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    font-weight: 500;
}

.license-footer-sub {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 0.25rem;
}

.license-footer-links {
    display: flex;
    gap: 1.5rem;
    font-size: 0.75rem;
}

.license-footer-links a {
    color: hsl(var(--muted-foreground));
}

.license-footer-links a:hover { color: hsl(var(--primary)); }

.license-footer-tag {
    max-width: 64rem;
    margin: 1.5rem auto 0;
    text-align: center;
    font-size: 0.625rem;
    letter-spacing: 0.08em;
    color: hsl(var(--muted-foreground) / 0.5);
}

@media (max-width: 768px) {
    .license-hotline { display: none; }
    .license-guide-grid { grid-template-columns: 1fr; }
    .license-footer-inner { flex-direction: column; text-align: center; }
    .license-footer-links { justify-content: center; }
}

/* 设备授权列表页 — 对齐 UXbot pageId 3329116 */
.license-page-list .license-main-list {
    align-items: stretch;
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: none;
}

.license-list-page {
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.license-list-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 0;
    margin-bottom: 1rem;
    background: hsl(var(--background));
    border-bottom: 1px solid hsl(var(--border));
}

.license-list-header-main {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.license-list-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.license-list-subtitle {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    max-width: 42rem;
}

.license-list-alert {
    margin-bottom: 1rem;
}

.btn-icon-back {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: none;
    background: transparent;
    color: hsl(var(--foreground));
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-icon-back:hover {
    background: hsl(var(--accent));
}

.btn-outline-sm {
    height: 2.25rem;
    padding: 0 0.75rem;
    background: transparent;
    border: 1px solid hsl(var(--input));
    color: hsl(var(--foreground));
    border-radius: calc(var(--radius) - 2px);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    text-decoration: none;
}

.btn-outline-sm:hover {
    background: hsl(var(--accent));
}

.license-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: hsl(var(--muted-foreground));
}

.license-empty svg {
    margin: 0 auto 1rem;
    opacity: 0.35;
}

.license-empty h2 {
    font-size: 1.125rem;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
}

.license-empty p {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.license-device-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.license-device-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.15s;
}

.license-device-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.license-device-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (min-width: 768px) {
    .license-device-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.license-device-field .field-label,
.license-device-modify .field-label,
.license-modal-device .field-label {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.25rem;
}

.license-collect-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.license-collect-label-row .field-label {
    margin-bottom: 0;
}

.license-row-collect-btn {
    height: 1.75rem;
    padding: 0 0.625rem;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.license-device-field .field-value,
.license-modal-device .field-value {
    font-size: 0.875rem;
}

.license-device-divider {
    border-top: 1px solid hsl(var(--border) / 0.5);
    margin: 1rem 0;
}

.license-device-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .license-device-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.license-modify-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modify-hint {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.badge-active {
    border-color: transparent;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.license-download-btn {
    height: 2.5rem;
    padding: 0 1rem;
    align-self: flex-start;
}

.license-status-badge {
    align-self: flex-start;
}

.license-device-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid hsl(var(--border) / 0.5);
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

@media (min-width: 768px) {
    .license-device-meta {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.license-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.license-modal[hidden] {
    display: none;
}

.license-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.license-modal-panel {
    position: relative;
    width: 100%;
    max-width: 28rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.license-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 0;
}

.license-modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.license-modal-body {
    padding: 1.25rem;
}

.license-modal-body > * + * {
    margin-top: 1rem;
}

.license-modal-device {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 0.75rem;
    background: hsl(var(--background));
    border-radius: calc(var(--radius) - 2px);
}

.license-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.license-modal-locked {
    color: hsl(var(--destructive));
}

/* 列表多选工具栏 */
.license-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    position: sticky;
    top: 4rem;
    z-index: 5;
}

.license-select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.license-selected-count {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.license-toolbar-actions {
    margin-left: auto;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.license-toolbar-actions .btn-primary {
    flex: 0 0 auto;
    height: 2.25rem;
    padding: 0 1.25rem;
    min-width: 7rem;
    white-space: nowrap;
}

.license-device-card.selectable {
    position: relative;
    padding-left: 2.75rem;
}

.license-device-card.is-selected {
    border-color: hsl(var(--primary) / 0.45);
    box-shadow: 0 0 0 1px hsl(var(--primary) / 0.15);
}

.license-device-check {
    position: absolute;
    left: 1rem;
    top: 1.25rem;
    cursor: pointer;
}

.license-device-check input {
    width: 1rem;
    height: 1rem;
    accent-color: hsl(var(--primary));
}

.license-modal-summary {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.5rem;
}

/* 下载确认页 — pageId 3329117 */
.license-download-page {
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.license-download-header {
    margin-bottom: 1.5rem;
}

.license-download-header-main {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.license-download-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.license-download-subtitle {
    margin-top: 0.25rem;
    padding-left: 0;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.license-download-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    margin-bottom: 1rem;
    overflow: hidden;
}

.license-download-card-head {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid hsl(var(--border) / 0.6);
}

.license-download-card-head h2 {
    font-size: 1rem;
    font-weight: 600;
}

.license-download-count {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

.license-download-card-body {
    padding: 1rem 1.25rem 1.25rem;
}

.license-download-order-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.license-auth-code {
    color: hsl(var(--primary));
    font-weight: 600;
}

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

.license-download-table {
    width: 100%;
    border-collapse: collapse;
}

.license-download-table th,
.license-download-table td {
    padding: 0.875rem 1.25rem;
    text-align: left;
    font-size: 0.875rem;
    border-bottom: 1px solid hsl(var(--border));
}

.license-download-table th {
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    background: hsl(var(--background));
}

.license-download-table tbody tr:last-child td {
    border-bottom: none;
}

.license-empty-inline {
    padding: 2rem 1.25rem;
    text-align: center;
    color: hsl(var(--muted-foreground));
}

.license-download-tip {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: hsl(var(--accent) / 0.35);
    border: 1px solid hsl(var(--accent));
    border-radius: var(--radius);
}

.license-download-tip svg {
    flex-shrink: 0;
    color: hsl(var(--accent-foreground));
    margin-top: 0.125rem;
}

.license-download-tip-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.license-download-tip p:last-child {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin: 0;
}

.license-download-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

@media (max-width: 768px) {
    .license-list-toolbar {
        top: 0;
    }

    .license-toolbar-actions {
        width: 100%;
        margin-left: 0;
    }

    .license-download-order-grid {
        grid-template-columns: 1fr;
    }
}
