:root {
    --bg: #f3f6f8;
    --panel: #ffffff;
    --text: #17242c;
    --muted: #667781;
    --line: #dce4e8;
    --line-strong: #c8d4da;
    --primary: #0b6f66;
    --primary-dark: #07554f;
    --primary-soft: #e7f5f2;
    --danger: #a5342b;
    --danger-soft: #fff0ee;
    --shadow: 0 14px 40px rgba(31, 54, 64, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
    background: var(--bg);
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 8% 0%, rgba(11, 111, 102, 0.1), transparent 34rem),
        linear-gradient(180deg, #f8fafb 0%, var(--bg) 55%);
    font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 72px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

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

h1 {
    margin-bottom: 8px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

h2 {
    margin-bottom: 0;
    font-size: 18px;
    letter-spacing: -0.01em;
}

.subtitle {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 15px;
}

.readonly-badge {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    flex: 0 0 auto;
    margin-top: 0;
    padding: 0 12px;
    border: 1px solid #b7ded8;
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    font-size: 12px;
    font-weight: 700;
}

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

.config-link {
    display: inline-flex;
    min-height: 32px;
    padding: 0 11px;
    align-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--primary);
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.config-link:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.token-bar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto auto auto;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.86);
}

.token-bar label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.token-bar input {
    min-height: 38px;
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 12px;
}

.token-bar .button {
    min-height: 38px;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 1px solid #eac3be;
    border-radius: 12px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 14px;
}

.panel {
    margin-bottom: 18px;
    padding: 24px;
    border: 1px solid rgba(215, 225, 229, 0.92);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.panel-heading > div:first-child {
    display: flex;
    align-items: center;
    gap: 11px;
}

.step-number {
    display: inline-grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 9px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 11px;
    font-weight: 800;
}

.status-text,
.hint {
    color: var(--muted);
    font-size: 13px;
}

.field-heading-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.collapse-button {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--primary);
    background: #fff;
    font-size: 12px;
    font-weight: 700;
}

.collapse-button:hover {
    border-color: #a8c9c4;
    background: var(--primary-soft);
}

.table-select-row,
.config-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.table-input-wrap {
    display: grid;
    gap: 7px;
}

.table-input-wrap select {
    width: 100%;
}

.table-input-wrap label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

input,
select {
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    outline: none;
    color: var(--text);
    background: #fff;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

input {
    width: 100%;
    padding: 0 13px;
}

select {
    padding: 0 30px 0 10px;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 111, 102, 0.12);
}

.button {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-weight: 700;
    transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
}

.button:not(:disabled):active {
    transform: translateY(1px);
}

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

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

.button.secondary {
    border-color: var(--line-strong);
    color: var(--text);
    background: #fff;
}

.button.secondary:not(:disabled):hover {
    border-color: var(--primary);
    color: var(--primary);
}

.button:disabled {
    opacity: 0.48;
}

.button.compact {
    min-height: 38px;
    padding: 0 14px;
}

.hint {
    margin: 10px 0 0;
}

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

.field-toolbar input {
    max-width: 330px;
}

.button-group {
    display: flex;
    gap: 4px;
}

.text-button {
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    color: var(--primary);
    background: transparent;
    font-size: 13px;
    font-weight: 700;
}

.text-button:hover {
    background: var(--primary-soft);
}

.field-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    max-height: 320px;
    overflow: auto;
    padding: 2px;
}

.field-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fbfcfc;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease;
}

.field-item:hover {
    border-color: #a8c9c4;
    background: #f7fbfa;
}

.field-item.selected {
    border-color: #94c9c1;
    background: var(--primary-soft);
}

.field-item input {
    width: 16px;
    min-height: 16px;
    margin: 3px 0 0;
    accent-color: var(--primary);
}

.field-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    font-weight: 750;
    word-break: break-all;
}

.field-type {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.field-comment {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-empty {
    grid-column: 1 / -1;
    padding: 30px 12px;
    color: var(--muted);
    text-align: center;
}

.primary-key {
    padding: 1px 5px;
    border-radius: 5px;
    color: #875b16;
    background: #fff1d3;
    font-size: 9px;
}

.index-badge {
    padding: 1px 5px;
    border-radius: 5px;
    color: #176657;
    background: #dcf2ed;
    font-size: 9px;
}

.filter-panel {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.filter-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.filter-heading h3 {
    margin: 0 0 3px;
    font-size: 15px;
}

.filter-heading span {
    color: var(--muted);
    font-size: 12px;
}

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

.filter-item {
    display: grid;
    gap: 6px;
}

.filter-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
}

.filter-caption strong {
    overflow: hidden;
    color: #42545d;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-caption small {
    flex: 0 0 auto;
    font-size: 9px;
}

.filter-item input {
    min-height: 38px;
    padding: 0 11px;
    font-size: 13px;
}

.query-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
}

.query-actions .hint {
    margin: 0;
}

.query-action-buttons {
    gap: 10px;
}

.result-heading {
    align-items: flex-start;
}

.result-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 16px;
}

.page-size-label {
    color: var(--muted);
    font-size: 12px;
}

.page-size-label select {
    min-height: 34px;
    margin: 0 4px;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 190px;
    padding: 30px;
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    color: var(--muted);
}

.empty-state strong {
    color: var(--text);
    font-size: 15px;
}

.empty-state span {
    font-size: 13px;
}

.table-scroll {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

table {
    width: 100%;
    min-width: 620px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

th,
td {
    max-width: 340px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #475962;
    background: #f6f8f9;
    font-size: 11px;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

th small {
    display: block;
    margin-top: 2px;
    color: #8b9aa2;
    font-size: 9px;
    font-weight: 600;
}

td {
    color: #31434c;
    word-break: break-word;
}

tbody tr:hover td {
    background: #f9fbfb;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.cell-null {
    color: #9ba7ad;
    font-style: italic;
}

.cell-code {
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 12px;
    white-space: pre-wrap;
}

.cell-truncated {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

.cell-truncated.cell-desc {
    max-width: 11em;
}

.aweme-link,
.video-link,
.original-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.aweme-link:hover,
.video-link:hover,
.original-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.cover-thumbnail {
    display: inline-flex;
    width: 80px;
    height: 52px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--primary);
    background: #f6f8f9;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    vertical-align: middle;
}

.cover-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 160ms ease;
}

.cover-thumbnail:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(11, 111, 102, 0.1);
}

.cover-thumbnail:hover img {
    transform: scale(1.04);
}

.cover-thumbnail.is-fallback:hover {
    text-decoration: underline;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.page-summary {
    min-width: 86px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.65;
}

@media (max-width: 820px) {
    .app-shell {
        width: min(100% - 22px, 1180px);
        padding-top: 28px;
    }

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

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

    .panel {
        padding: 19px;
    }

    .result-heading {
        display: grid;
    }

    .result-meta {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .page-header,
    .panel-heading,
    .table-select-row,
    .config-select-row,
    .field-toolbar,
    .query-actions {
        display: grid;
    }

    .readonly-badge {
        margin-top: 0;
    }

    .token-bar {
        grid-template-columns: 1fr;
    }

    .table-select-row .button,
    .query-actions .button,
    .query-actions .button-group {
        width: 100%;
    }

    .query-action-buttons {
        display: grid;
        grid-template-columns: 1fr;
    }

    .field-list {
        grid-template-columns: 1fr;
    }

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

    .field-toolbar input {
        max-width: none;
    }

    .button-group {
        justify-content: flex-end;
    }

    .pagination {
        justify-content: space-between;
    }
}

/* Data query workspace */
.query-page {
    --bg: #f5faf8;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #6b7b78;
    --line: #e3ebe8;
    --line-strong: #d1dfda;
    --primary: #76b943;
    --primary-dark: #4d8d2e;
    --primary-soft: #f0f9e9;
    --shadow: 0 18px 48px rgba(44, 92, 74, 0.07);
    background:
        radial-gradient(circle at 10% 8%, rgba(116, 190, 74, 0.08), transparent 28rem),
        radial-gradient(circle at 92% 18%, rgba(105, 184, 210, 0.07), transparent 32rem),
        linear-gradient(105deg, #f4fbf6 0%, #f7fafa 48%, #f2f7fc 100%);
}

.query-page .site-header-host {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 62px;
}

.query-page .site-header {
    position: relative;
    border-bottom: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 2px 12px rgba(55, 91, 75, 0.025);
}

.query-page .site-header-inner {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: flex-start;
    gap: 38px;
    width: min(1400px, calc(100% - 40px));
    margin: 0 auto;
}

.query-page .brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    flex: 0 0 auto;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
}

.query-page .brand-mark {
    display: inline-grid;
    width: 31px;
    height: 31px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 9px;
    color: #fff;
    background: linear-gradient(145deg, #8fc64f 0%, #75b944 42%, #63c8b2 100%);
    box-shadow: 0 6px 14px rgba(102, 176, 77, 0.22);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.06em;
    overflow: hidden;
}

.query-page .brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.query-page .brand-copy {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.query-page .brand-title {
    display: block;
    overflow: hidden;
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.query-page .brand-copy small {
    color: #91a09b;
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.13em;
}

.query-page .site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    font-family: fangsong;
}

.query-page .site-nav a {
    position: relative;
    padding: 9px 12px;
    border-radius: 8px;
    color: #515b58;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: color 150ms ease, background 150ms ease;
}

.query-page .site-nav a:hover {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.query-page .site-nav a.active {
    color: #202824;
    font-weight: 700;
}

.query-page .site-nav a.active::after {
    position: absolute;
    right: 13px;
    bottom: 2px;
    left: 13px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #8ac64b, #62c7ae);
    content: "";
}

.query-page .app-shell {
    width: min(1400px, calc(100% - 40px));
    padding: 24px 0 52px;
}

.query-page .page-header-actions {
    position: relative;
    z-index: 10;
    flex: 0 0 auto;
    margin-left: auto;
}

.query-page .settings-menu {
    position: relative;
}

.query-page .settings-trigger {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    color: #3f3748;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 20px rgba(55, 91, 75, 0.05);
    font-size: 13px;
    font-weight: 800;
    list-style: none;
    cursor: pointer;
    user-select: none;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.query-page .settings-trigger::-webkit-details-marker {
    display: none;
}

.query-page .settings-trigger:hover,
.query-page .settings-trigger:focus-visible,
.query-page .settings-menu[open] .settings-trigger {
    border-color: #bbd99a;
    outline: none;
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.query-page .settings-icon {
    width: 17px;
    height: 17px;
    fill: currentColor;
    transition: transform 180ms ease;
}

.query-page .settings-menu[open] .settings-icon {
    transform: rotate(35deg);
}

.query-page .settings-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(390px, calc(100vw - 32px));
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 65px rgba(24, 49, 57, 0.18);
}

.query-page .settings-popover-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--line);
}

.query-page .settings-popover-heading > div {
    display: grid;
    gap: 2px;
}

.query-page .settings-popover-heading strong {
    font-size: 14px;
}

.query-page .settings-popover-heading > div span {
    color: var(--muted);
    font-size: 10px;
}

.query-page .settings-popover-heading .status-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-top: 2px;
    font-size: 10px;
    white-space: nowrap;
}

.query-page .settings-popover-heading .status-text::before {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #a7b4ba;
    content: "";
}

.query-page .settings-popover-heading .status-text.is-ready::before {
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 111, 102, 0.1);
}

.query-page .settings-field {
    display: grid;
    gap: 7px;
}

.query-page .settings-field label {
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
}

.query-page .settings-field input {
    min-height: 40px;
    border-color: #dfe9e3;
    background: #fbfdfb;
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 12px;
}

.query-page .token-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
}

.query-page .token-actions .button {
    min-height: 38px;
    white-space: nowrap;
}

.query-page .token-actions .text-button {
    margin-left: auto;
}

.query-page .notice {
    margin-bottom: 16px;
}

.query-page .panel {
    margin-bottom: 16px;
    padding: 22px;
    border-color: rgba(229, 225, 235, 0.98);
}

.query-page .panel-heading {
    gap: 16px;
    margin-bottom: 16px;
}

.query-page .panel-heading > div:first-child {
    gap: 10px;
}

.query-page .step-number {
    width: 32px;
    height: 32px;
    border: 1px solid #dcecc9;
    border-radius: 10px;
}

.query-page .query-panel {
    padding: 18px 20px;
    box-shadow: 0 10px 30px rgba(76, 36, 95, 0.05);
}

.query-page .query-panel .panel-heading {
    margin-bottom: 13px;
}

.query-page .query-panel .config-select-row {
    grid-template-columns: minmax(240px, 1fr) auto auto auto;
}

.query-page .result-panel {
    overflow: visible;
}

.query-page .field-selection-control {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid var(--line);
}

.query-page .query-fields-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.query-page .query-option-label {
    color: #8a9690;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.query-page .query-fields-copy .status-text {
    overflow: hidden;
    color: #405047;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.query-page .field-selection-control .button {
    flex: 0 0 auto;
}

.query-page .query-options {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.query-page .query-fields-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.query-page .field-toolbar {
    gap: 10px;
    margin-bottom: 11px;
}

.query-page .field-toolbar input {
    max-width: none;
}

.query-page .field-toolbar .button-group {
    flex: 0 0 auto;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fbfdfb;
}

.query-page .field-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    max-height: 390px;
    padding: 1px 3px 1px 1px;
    scrollbar-gutter: stable;
}

.query-page .field-item {
    padding: 10px 11px;
    border-color: #e8eee9;
    border-radius: 10px;
    background: #fcfdfc;
}

.query-page .field-item:hover {
    border-color: #cfe5b8;
    background: #f9fdf6;
}

.query-page .field-item.selected {
    border-color: #97cb6d;
    background: #f0f9e9;
}

.query-page .field-comment {
    max-width: 100%;
}

.query-page .filter-panel {
    margin-top: 13px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
        linear-gradient(145deg, rgba(240, 249, 233, 0.9), rgba(249, 253, 251, 0.94));
}

.query-page .filter-heading {
    margin-bottom: 13px;
}

.query-page .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.query-page .filter-item input {
    border-color: #dfe9e3;
    background: rgba(255, 255, 255, 0.94);
}

.query-page .query-actions {
    gap: 18px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.query-page .query-action-buttons {
    flex: 0 0 auto;
}

.query-page .query-panel .config-select-row > .button {
    min-width: 112px;
}

.query-page .query-action-buttons .button {
    min-width: 128px;
}

.query-page .button.primary {
    border-color: transparent;
    background: linear-gradient(135deg, #8bc64b 0%, #6fbd68 52%, #5fc2a6 100%);
    box-shadow: 0 8px 18px rgba(102, 177, 80, 0.2);
}

.query-page .button.primary:not(:disabled):hover {
    background: linear-gradient(135deg, #76b13a 0%, #5caa58 52%, #49ad92 100%);
}

.query-page.field-dialog-open {
    overflow: hidden;
}

.query-page .field-dialog-layer {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 24px;
}

.query-page .field-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 31, 27, 0.42);
    backdrop-filter: blur(3px);
}

.query-page .field-dialog {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(920px, calc(100vw - 32px));
    max-height: min(82vh, 760px);
    overflow: hidden;
    border: 1px solid rgba(221, 230, 225, 0.96);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(20, 34, 28, 0.24);
}

.query-page .field-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line);
}

.query-page .field-dialog-header h2 {
    margin-top: 3px;
    font-size: 20px;
}

.query-page .field-dialog-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.query-page .dialog-close-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #68746e;
    background: #fafcfb;
    font-size: 22px;
    line-height: 1;
}

.query-page .dialog-close-button:hover {
    border-color: #c9dcc0;
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.query-page .field-dialog-content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    padding: 15px 22px;
}

.query-page .field-dialog-content .field-toolbar {
    margin-bottom: 12px;
}

.query-page .field-dialog-content .field-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: min(54vh, 500px);
    overflow: auto;
    padding-right: 5px;
}

.query-page .field-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 22px 16px;
    border-top: 1px solid var(--line);
    background: #fbfdfb;
}

.query-page .field-dialog-footer .status-text {
    color: #5e6b64;
    font-size: 12px;
}

.query-page .field-dialog-footer .button-group {
    flex: 0 0 auto;
}

.query-page .field-dialog-footer .button {
    min-width: 82px;
}

.query-page.export-dialog-open {
    overflow: hidden;
}

.query-page .export-confirm-layer {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: grid;
    place-items: center;
    padding: 20px;
}

.query-page .export-confirm-dialog {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    width: min(520px, calc(100vw - 32px));
    padding: 26px;
    border: 1px solid rgba(219, 229, 223, 0.95);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 34px 100px rgba(8, 25, 15, 0.28);
}

.query-page .export-confirm-icon {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    color: #245d41;
    background: #edf7f0;
}

.query-page .export-confirm-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.query-page .export-confirm-dialog h2 {
    margin: 3px 0 7px;
    font-size: 21px;
}

.query-page .export-confirm-summary {
    margin: 0;
    color: #4f6057;
    font-size: 13px;
    line-height: 1.75;
}

.query-page .export-confirm-note {
    margin: 8px 0 0;
    color: #8a9690;
    font-size: 11px;
    line-height: 1.7;
}

.query-page .export-confirm-actions {
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
    padding-top: 16px;
    border-top: 1px solid #e6ece8;
}

.query-page .export-confirm-actions .button {
    min-width: 96px;
}

.query-page input:focus,
.query-page select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(118, 185, 67, 0.14);
}

.query-page .result-panel {
    padding: 20px;
}

.query-page .result-heading {
    margin-bottom: 14px;
}

.query-page .result-expiry-tip {
    margin-left: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
}

.query-page .result-meta {
    gap: 12px;
}

.query-page .table-scroll {
    max-height: clamp(320px, 58vh, 720px);
    scrollbar-gutter: stable;
}

.query-page table {
    min-width: 760px;
}

.query-page th {
    padding: 12px 14px;
    background: #f4faf5;
}

.query-page td {
    padding: 12px 14px;
}

.query-page tbody tr:nth-child(even) td {
    background: #fbfdfc;
}

.query-page tbody tr:hover td {
    background: #f3faee;
}

.query-page .pagination {
    margin-bottom: 0;
}

@media (max-width: 980px) {
    .query-page .query-panel .config-select-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .query-page .query-panel .config-select-row > .button {
        min-width: 108px;
    }

    .query-page .field-selection-control {
        grid-column: 1 / -1;
        padding-top: 10px;
        padding-left: 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

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

    .query-page .field-dialog-content .field-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .query-page .site-header-host {
        min-height: 60px;
    }

    .query-page .site-header-inner {
        width: min(100% - 24px, 1400px);
    }

    .query-page .site-header-inner {
        min-height: 60px;
        gap: 12px;
    }

    .query-page .site-nav {
        display: none;
    }

    .query-page .app-shell {
        width: min(100% - 24px, 1400px);
        padding: 20px 0 32px;
    }

    .query-page .panel,
    .query-page .query-panel,
    .query-page .result-panel {
        padding: 16px;
    }

    .query-page .panel-heading {
        display: grid;
    }

    .query-page .query-actions {
        display: grid;
        align-items: stretch;
    }

    .query-page .query-action-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .query-page .query-action-buttons .button {
        min-width: 0;
    }

    .query-page .result-meta {
        justify-content: space-between;
    }

    .query-page .field-dialog-layer {
        padding: 12px;
    }

    .query-page .field-dialog {
        width: min(100%, 920px);
        max-height: calc(100vh - 24px);
        border-radius: 16px;
    }

    .query-page .field-dialog-header {
        padding: 16px 16px 13px;
    }

    .query-page .field-dialog-content {
        padding: 12px 16px;
    }

    .query-page .field-dialog-footer {
        padding: 12px 16px 14px;
    }
}

@media (max-width: 560px) {
    .query-page .brand-mark {
        width: 31px;
        height: 31px;
    }

    .query-page .brand-title {
        font-size: 17px;
    }

    .query-page .settings-trigger {
        min-width: 42px;
        justify-content: center;
        padding: 0 11px;
    }

    .query-page .settings-trigger span {
        display: none;
    }

    .query-page .settings-popover {
        width: min(340px, calc(100vw - 24px));
    }

    .query-page .query-panel .config-select-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .query-page .query-panel .config-select-row > .button {
        width: 100%;
    }

    .query-page .filter-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .query-page .field-dialog-content .field-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .query-page .field-selection-control {
        flex-wrap: wrap;
    }

    .query-page .field-dialog-header p {
        max-width: 230px;
    }

    .query-page .field-dialog-footer {
        display: grid;
    }

    .query-page .field-dialog-footer .button-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .query-page .field-dialog-footer .button {
        min-width: 0;
    }

    .query-page .export-confirm-layer {
        padding: 12px;
    }

    .query-page .export-confirm-dialog {
        padding: 20px;
        border-radius: 16px;
    }

    .query-page .export-confirm-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .query-page .export-confirm-actions .button {
        min-width: 0;
    }

    .query-page .query-action-buttons {
        grid-template-columns: minmax(0, 1fr);
    }

    .query-page .pagination {
        gap: 8px;
    }
}
