:root,
:root[data-theme="light"] {
    color-scheme: light;
    --canvas: #f5f7fb;
    --canvas-accent: #eef0ff;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-muted: #f0f3f8;
    --surface-hover: #f7f8fc;
    --border: #dfe4ed;
    --border-strong: #cbd3df;
    --text: #182033;
    --text-soft: #445069;
    --muted: #6f7b90;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-contrast: #ffffff;
    --primary-soft: #eeefff;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-soft: #fff1f2;
    --highlight: #fcd34d;
    --highlight-text: #3b2f0b;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-md: 0 18px 50px rgba(35, 45, 74, .11);
    --overlay: rgba(20, 27, 43, .52);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    font-family: Inter, Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #0c121d;
    --canvas-accent: #13182d;
    --surface: #131c2a;
    --surface-raised: #182232;
    --surface-muted: #1c2738;
    --surface-hover: #202c3e;
    --border: #29364a;
    --border-strong: #3a4960;
    --text: #eef2f8;
    --text-soft: #c5cedc;
    --muted: #98a5b8;
    --primary: #8b83ff;
    --primary-hover: #a49eff;
    --primary-contrast: #111329;
    --primary-soft: #25254a;
    --danger: #fb7185;
    --danger-hover: #fda4af;
    --danger-soft: #3a202a;
    --highlight: #fbbf24;
    --highlight-text: #271b02;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-md: 0 24px 60px rgba(0, 0, 0, .28);
    --overlay: rgba(2, 6, 15, .76);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 8% 2%, var(--canvas-accent), transparent 31rem),
        var(--canvas);
    line-height: 1.55;
    transition: color .2s ease, background-color .2s ease;
}

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

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 32%, transparent);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header {
    position: relative;
    z-index: 20;
    height: 64px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(18px);
}

.header-inner {
    width: min(1440px, 100%);
    height: 100%;
    margin: 0 auto;
    padding: 0 clamp(18px, 3vw, 42px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    font-size: .98rem;
    font-weight: 800;
    letter-spacing: -.025em;
    white-space: nowrap;
}

.brand-mark {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--primary-contrast);
    background: var(--primary);
    font-size: .88rem;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 28%, transparent);
}

.header-actions,
.primary-nav,
.header-tools {
    display: flex;
    align-items: center;
}

.header-actions {
    min-width: 0;
    justify-content: flex-end;
    gap: clamp(14px, 2.2vw, 30px);
}

.primary-nav {
    gap: 6px;
}

.primary-nav a,
.link-button {
    border: 0;
    border-radius: 9px;
    padding: 8px 11px;
    color: var(--text-soft);
    background: transparent;
    font-size: .9rem;
    font-weight: 650;
}

.primary-nav a:hover,
.link-button:hover {
    color: var(--text);
    background: var(--surface-muted);
}

.header-tools {
    gap: 8px;
}

.tool-button,
.icon-button {
    border: 1px solid var(--border);
    color: var(--text-soft);
    background: var(--surface);
}

.tool-button {
    width: 37px;
    height: 37px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 10px;
}

.tool-button:hover,
.icon-button:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-muted);
}

.theme-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon-sun,
:root[data-theme="dark"] .theme-icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
    display: block;
}

.language-label {
    display: block;
}

.language-label select {
    min-height: 37px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 30px 6px 10px;
    color: var(--text-soft);
    background: var(--surface);
    font-size: .86rem;
}

.page-shell {
    width: min(1160px, calc(100% - 36px));
    margin: 0 auto;
    padding: clamp(44px, 6vw, 74px) 0 90px;
}

.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 34px;
}

h1,
h2,
p {
    overflow-wrap: anywhere;
}

h1,
h2 {
    color: var(--text);
    line-height: 1.16;
}

h1 {
    margin: 0;
    font-size: clamp(2.15rem, 5vw, 3.65rem);
    letter-spacing: -.055em;
}

h2 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: -.025em;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary);
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.page-lead,
.muted,
small,
.policy-note {
    color: var(--muted);
}

.page-lead {
    max-width: 650px;
    margin: 13px 0 0;
    font-size: 1.02rem;
}

.primary-button,
.secondary-button,
.danger-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-weight: 750;
    line-height: 1.2;
    transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}

.primary-button {
    border: 1px solid var(--primary);
    color: var(--primary-contrast);
    background: var(--primary);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 18%, transparent);
}

.primary-button:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.secondary-button {
    border: 1px solid var(--border);
    color: var(--text-soft);
    background: var(--surface);
}

.secondary-button:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.danger-button {
    border: 1px solid var(--danger);
    color: #ffffff;
    background: var(--danger);
}

:root[data-theme="dark"] .danger-button {
    color: #2b0b12;
}

.danger-button:hover {
    border-color: var(--danger-hover);
    background: var(--danger-hover);
}

.danger-ghost {
    color: var(--danger);
}

.full-button {
    width: 100%;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
    opacity: .55;
    cursor: wait;
    transform: none;
}

form {
    display: grid;
    gap: 18px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--text-soft);
    font-size: .89rem;
    font-weight: 680;
}

input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    color: var(--text);
    background: var(--surface);
    outline: none;
}

input::placeholder {
    color: color-mix(in srgb, var(--muted) 76%, transparent);
}

input:hover {
    border-color: color-mix(in srgb, var(--primary) 48%, var(--border));
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 0;
    accent-color: var(--primary);
}

.check-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    font-weight: 520;
    line-height: 1.5;
}

.check-row input {
    margin-top: 2px;
}

.form-error {
    min-height: 1.2em;
    margin: 0;
    color: var(--danger);
    font-size: .88rem;
}

.policy-note {
    margin: 18px 0 0;
    font-size: .82rem;
    line-height: 1.55;
}

.auth-shell {
    min-height: calc(100vh - 64px);
    display: grid;
    align-items: center;
    padding: clamp(34px, 6vw, 76px) 20px;
}

.auth-layout {
    width: min(1050px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(370px, .82fr);
    gap: clamp(48px, 8vw, 110px);
    align-items: center;
}

.auth-intro {
    max-width: 570px;
}

.intro-mark {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    margin-bottom: 32px;
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
    border-radius: 20px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: .85rem;
    font-weight: 900;
    letter-spacing: .08em;
    box-shadow: var(--shadow-sm);
}

.auth-intro h1 {
    max-width: 620px;
    font-size: clamp(2.7rem, 6vw, 5rem);
}

.auth-intro > p:not(.eyebrow) {
    max-width: 560px;
    margin: 22px 0 0;
    color: var(--text-soft);
    font-size: clamp(1rem, 2vw, 1.15rem);
}

.trust-note {
    max-width: 500px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 36px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .9rem;
}

.trust-note > span {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 900;
}

.trust-note p {
    margin: 1px 0 0;
}

.auth-card {
    padding: clamp(28px, 4vw, 42px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    box-shadow: var(--shadow-md);
}

.card-heading h2 {
    font-size: clamp(1.8rem, 4vw, 2.35rem);
    letter-spacing: -.045em;
}

.card-heading .muted {
    margin: 10px 0 0;
}

.auth-card form {
    margin-top: 28px;
}

.auth-switch {
    margin: 23px 0 0;
    color: var(--muted);
    font-size: .9rem;
    text-align: center;
}

.auth-switch a {
    font-weight: 750;
}

.auth-card .policy-note {
    padding-top: 17px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.dashboard-heading .primary-button {
    flex: 0 0 auto;
}

.storage-card {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr);
    align-items: center;
    gap: 28px;
    margin-bottom: 24px;
    padding: 17px 19px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.storage-copy {
    display: flex;
    align-items: center;
    gap: 12px;
}

.storage-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: .65rem;
    font-weight: 900;
    letter-spacing: .05em;
}

.storage-title {
    display: block;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
}

#storage-label {
    display: block;
    margin-top: 2px;
    color: var(--text);
    font-size: .92rem;
}

.meter {
    height: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--surface-muted);
}

.meter span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width .25s ease;
}

.dataset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
}

.dataset-card {
    min-width: 0;
    min-height: 184px;
    display: grid;
    gap: 14px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.dataset-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    box-shadow: var(--shadow-md);
}

.dataset-card h2 {
    font-size: 1.12rem;
}

.dataset-meta {
    color: var(--muted);
    font-size: .84rem;
}

.dataset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.dataset-actions .primary-button,
.dataset-actions .secondary-button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: .84rem;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 86px 20px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--muted);
    background: color-mix(in srgb, var(--surface) 62%, transparent);
    text-align: center;
}

dialog {
    width: min(520px, calc(100% - 28px));
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    background: var(--surface-raised);
    box-shadow: var(--shadow-md);
}

dialog::backdrop {
    background: var(--overlay);
    backdrop-filter: blur(5px);
}

dialog form {
    margin: 0;
}

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.dialog-heading .eyebrow {
    margin-bottom: 7px;
}

.icon-button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 10px;
    font-size: 1.45rem;
    line-height: 1;
}

.file-field input {
    padding: 8px;
}

.file-field input::file-selector-button {
    margin-right: 10px;
    border: 0;
    border-radius: 7px;
    padding: 7px 10px;
    color: var(--text);
    background: var(--surface-muted);
    font-weight: 650;
}

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

.settings-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 20px;
    padding: clamp(22px, 4vw, 32px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.settings-panel p {
    max-width: 720px;
    margin: 10px 0 0;
    color: var(--muted);
}

.panel-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: .82rem;
    font-weight: 850;
}

.inline-note {
    padding: 11px 13px;
    border-radius: 9px;
    color: var(--text-soft) !important;
    background: var(--surface-muted);
    font-size: .87rem;
}

.danger-zone {
    border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
}

.danger-icon {
    color: var(--danger);
    background: var(--danger-soft);
}

.danger-zone form {
    max-width: 440px;
    margin-top: 22px;
}

.search-shell {
    height: calc(100vh - 64px);
    min-height: 600px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background: var(--surface);
}

#dataset-context {
    display: none;
}

.search-toolbar {
    display: grid;
    grid-template-columns: auto minmax(170px, .55fr) minmax(300px, 1fr);
    align-items: center;
    gap: 22px;
    padding: 16px clamp(18px, 3vw, 36px);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 700;
}

.back-link:hover {
    color: var(--text);
}

.dataset-title {
    min-width: 0;
}

.dataset-title .eyebrow {
    margin-bottom: 4px;
}

.search-toolbar h1 {
    overflow: hidden;
    font-size: 1.22rem;
    letter-spacing: -.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    margin: 0;
}

.search-form input,
.search-form .primary-button {
    min-height: 43px;
}

.split-view {
    --left-width: 42%;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--left-width) 7px minmax(0, 1fr);
    background: var(--surface);
}

.result-pane,
.source-pane {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 48px minmax(0, 1fr);
}

.result-pane {
    border-right: 1px solid var(--border);
}

.pane-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    background: var(--surface-muted);
    font-size: .8rem;
    font-weight: 650;
}

.source-heading {
    justify-content: space-between;
    gap: 12px;
    padding-block: 6px;
}

.source-pagination {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.source-pagination button {
    min-height: 30px;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 4px 9px;
    color: var(--text-soft);
    background: var(--surface);
    font-size: .75rem;
    font-weight: 650;
}

.source-pagination button:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.source-pagination button:disabled {
    color: var(--muted);
    opacity: .48;
    cursor: default;
}

#source-range {
    min-width: 92px;
    text-align: center;
    font-size: .74rem;
}

.split-resizer {
    position: relative;
    z-index: 2;
    cursor: col-resize;
    background: var(--surface-muted);
}

.split-resizer::after {
    content: "";
    position: absolute;
    inset: 0 2px;
    border-radius: 99px;
    background: var(--border-strong);
    opacity: .7;
}

.split-resizer:hover::after,
.split-resizer:focus::after {
    background: var(--primary);
    opacity: 1;
}

.split-resizer:focus {
    outline: none;
}

.scroll-pane,
.source-viewport {
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: var(--border-strong) transparent;
    scrollbar-width: thin;
}

.result-card {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: 7px;
    padding: 16px 18px;
    border: 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-align: left;
    background: transparent;
}

.result-card:hover,
.result-card:focus-visible {
    background: var(--surface-hover);
}

.line-badge {
    color: var(--primary);
    font-size: .73rem;
    font-weight: 800;
}

.result-preview,
.source-line-text {
    min-width: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.result-preview {
    font-size: .91rem;
    line-height: 1.65;
}

.search-highlight {
    padding: 0 .08em;
    border-radius: 3px;
    color: var(--highlight-text);
    background: var(--highlight);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.source-window {
    min-width: 0;
}

.source-line {
    min-width: 0;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    transition: background-color .25s ease;
}

.source-line.highlight {
    background: var(--primary-soft);
}

.source-line-number {
    padding: 9px 13px 9px 8px;
    border-right: 1px solid var(--border);
    color: var(--muted);
    background: color-mix(in srgb, var(--surface-muted) 65%, transparent);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .74rem;
    text-align: right;
    user-select: none;
}

.source-line-text {
    padding: 9px 15px;
    color: var(--text-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .83rem;
    line-height: 1.65;
}

.admin-section {
    margin-top: 18px;
    padding: clamp(20px, 3vw, 28px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 12px;
}

.metric-card {
    min-width: 0;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 650;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    color: var(--text);
    font-size: 1.5rem;
    letter-spacing: -.035em;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.section-heading .eyebrow {
    margin-bottom: 6px;
}

.range-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 9px;
    margin: 0;
}

.range-form label {
    min-width: 145px;
}

.range-form input {
    min-height: 39px;
    padding-block: 7px;
}

.range-form .primary-button {
    min-height: 39px;
}

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

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
}

.metrics-table th,
.metrics-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.metrics-table th {
    color: var(--muted);
    background: var(--surface-muted);
    font-size: .75rem;
    font-weight: 750;
}

.metrics-table th:first-child,
.metrics-table td:first-child {
    text-align: left;
}

.metrics-table tbody tr:hover {
    background: var(--surface-hover);
}

.not-found {
    min-height: 56vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.not-found-code {
    margin-bottom: 10px;
    color: var(--primary-soft);
    font-size: clamp(5rem, 18vw, 11rem);
    font-weight: 900;
    letter-spacing: -.09em;
    line-height: .8;
    -webkit-text-stroke: 1px color-mix(in srgb, var(--primary) 35%, transparent);
}

.not-found .page-lead {
    margin-bottom: 26px;
}

.toast {
    position: fixed;
    z-index: 100;
    right: 20px;
    bottom: 20px;
    max-width: min(390px, calc(100% - 40px));
    padding: 12px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    color: var(--text);
    background: var(--surface-raised);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 820px) {
    .auth-layout {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .auth-intro {
        text-align: center;
        margin: 0 auto;
    }

    .intro-mark {
        margin: 0 auto 22px;
    }

    .auth-intro h1 {
        font-size: clamp(2.35rem, 10vw, 3.6rem);
    }

    .trust-note {
        justify-content: center;
        margin: 25px auto 0;
        text-align: left;
    }

    .search-toolbar {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 11px 16px;
    }

    .search-form {
        grid-column: 1 / -1;
    }

    .split-view {
        --left-width: 45%;
        grid-template-columns: var(--left-width) 6px minmax(0, 1fr);
    }

    .source-line {
        grid-template-columns: 58px minmax(0, 1fr);
    }

    .source-line-number {
        padding-inline: 6px 10px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .site-header {
        height: 58px;
    }

    .header-inner {
        padding-inline: 12px;
        gap: 10px;
    }

    .brand > span:last-child,
    .primary-nav {
        display: none;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
    }

    .header-actions {
        gap: 6px;
    }

    .header-tools {
        gap: 5px;
    }

    .language-label select {
        max-width: 92px;
    }

    .link-button {
        padding-inline: 7px;
    }

    .page-shell {
        width: min(100% - 24px, 1160px);
        padding-top: 36px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 25px;
    }

    h1 {
        font-size: 2.25rem;
    }

    .dashboard-heading .primary-button {
        width: 100%;
    }

    .storage-card {
        grid-template-columns: 1fr;
        gap: 14px;
    }

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

    .settings-panel {
        grid-template-columns: 1fr;
    }

    .auth-shell {
        min-height: calc(100vh - 58px);
        padding: 30px 12px 50px;
    }

    .auth-intro > p:not(.eyebrow),
    .trust-note {
        display: none;
    }

    .auth-card {
        padding: 25px 20px;
    }

    .search-shell {
        height: calc(100dvh - 58px);
        min-height: 560px;
    }

    .search-toolbar {
        padding: 11px 12px;
    }

    .dataset-title .eyebrow {
        display: none;
    }

    .search-toolbar h1 {
        font-size: 1rem;
    }

    .back-link span:last-child {
        display: none;
    }

    .pane-heading {
        padding-inline: 10px;
    }

    .source-heading > span {
        display: none;
    }

    .source-heading {
        justify-content: center;
    }

    .source-pagination {
        gap: 4px;
    }

    .source-pagination button {
        padding-inline: 6px;
    }

    #source-range {
        min-width: 70px;
        font-size: .67rem;
    }

    .source-line {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .source-line-text {
        padding-inline: 10px;
    }

    .range-form {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .range-form label {
        min-width: 0;
    }

    .range-form .primary-button {
        grid-column: 1 / -1;
    }

    dialog {
        padding: 23px 19px;
    }
}

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