:root {
    --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "DM Mono", Consolas, monospace;
    --bg-app: #0b0d0f;
    --bg-panel: rgba(18, 21, 24, 0.78);
    --bg-panel-strong: rgba(24, 28, 32, 0.94);
    --bg-input: rgba(255, 255, 255, 0.045);
    --border-color: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(125, 211, 190, 0.28);
    --text-primary: #f4f7f6;
    --text-secondary: #a9b4b0;
    --text-muted: #68736f;
    --color-primary: #7dd3be;
    --color-primary-soft: rgba(125, 211, 190, 0.13);
    --color-secondary: #8fb8ff;
    --color-secondary-soft: rgba(143, 184, 255, 0.13);
    --color-success: #46d27f;
    --color-success-soft: rgba(70, 210, 127, 0.13);
    --color-warning: #f2b84b;
    --color-warning-soft: rgba(242, 184, 75, 0.13);
    --color-error: #ff6f7d;
    --color-error-soft: rgba(255, 111, 125, 0.13);
    --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.28);
    --radius: 8px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.light-theme {
    --bg-app: #eef1ee;
    --bg-panel: rgba(255, 255, 255, 0.82);
    --bg-panel-strong: rgba(255, 255, 255, 0.96);
    --bg-input: rgba(10, 13, 15, 0.045);
    --border-color: rgba(10, 13, 15, 0.1);
    --text-primary: #121518;
    --text-secondary: #4f5a57;
    --text-muted: #7a8582;
    --shadow-md: 0 18px 46px rgba(20, 30, 28, 0.12);
}

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

html {
    font-size: 16px;
}

body {
    min-height: 100vh;
    font-family: var(--font-sans);
    line-height: 1.55;
    color: var(--text-primary);
    background:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        radial-gradient(circle at 18% 0%, rgba(125, 211, 190, 0.18), transparent 32rem),
        linear-gradient(145deg, #090b0d 0%, var(--bg-app) 44%, #111417 100%);
    background-size: 34px 34px, 34px 34px, auto, auto;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(1440px, calc(100vw - 40px));
    margin: 0 auto;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(8, 10, 12, 0.76);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(18px);
}

.header-container {
    height: 72px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
}

.back-link,
.header-actions,
.brand-lockup,
.btn,
.btn-icon {
    display: inline-flex;
    align-items: center;
}

.back-link {
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 700;
}

.back-link svg,
.btn svg,
.btn-icon svg,
.tab-btn svg,
.card-header svg {
    width: 16px;
    height: 16px;
}

.brand-lockup {
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #06110e;
    background: var(--color-primary);
}

.brand-lockup h1 {
    font-size: 1.18rem;
    line-height: 1.1;
    letter-spacing: 0;
}

.brand-lockup p {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.header-actions {
    justify-content: flex-end;
    gap: 10px;
}

.version-badge,
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
}

.btn-icon {
    width: 38px;
    height: 38px;
    justify-content: center;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-input);
}

.app-main {
    padding: 30px 0 44px;
}

.tool-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.7fr);
    gap: 28px;
    align-items: end;
    margin-bottom: 22px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tool-hero h2 {
    max-width: 760px;
    font-size: clamp(2rem, 5vw, 4.6rem);
    line-height: 0.98;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

.tool-hero p {
    max-width: 100%;
    color: var(--text-secondary);
    font-size: 0.96rem;
    overflow-wrap: anywhere;
}

.capture-strip,
.card,
.upload-card,
.raw-preview-container,
.compare-column,
.no-selection-state {
    border-radius: var(--radius);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
}

.capture-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-bottom: 18px;
}

.capture-strip span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.upload-card {
    padding: 8px;
}

.drop-zone {
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.22s var(--ease), background 0.22s var(--ease);
}

.drop-zone:hover,
.drop-zone.dragover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-content {
    display: grid;
    justify-items: center;
    gap: 18px;
    text-align: center;
    padding: 28px;
}

.upload-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    background: var(--color-primary-soft);
    border: 1px solid var(--border-strong);
}

.upload-icon-wrapper svg {
    width: 30px;
    height: 30px;
}

.drop-zone h2 {
    font-size: clamp(1.35rem, 3vw, 2rem);
    letter-spacing: -0.02em;
}

.drop-zone p,
.file-limits-info {
    color: var(--text-secondary);
}

.file-limits-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    font-size: 0.78rem;
}

.file-limits-info span {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 5px 9px;
    background: var(--bg-input);
}

.highlight {
    color: var(--color-primary);
}

.workspace-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    animation: fade-in 0.35s var(--ease);
}

.col-span-12 {
    grid-column: span 12;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none !important;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: 1.1fr 0.8fr 0.8fr;
    gap: 16px;
}

.stat-card {
    min-height: 112px;
    padding: 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bg-success-glow { color: var(--color-success); background: var(--color-success-soft); }
.bg-info-glow { color: var(--color-secondary); background: var(--color-secondary-soft); }
.bg-warning-glow { color: var(--color-warning); background: var(--color-warning-soft); }

.stat-details h3 {
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-value,
.stat-details .stat-value {
    display: inline-block;
    margin-top: 3px;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}

.stat-value-group {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.stat-label,
.stat-desc,
.size-comparison {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.size-comparison {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 7px;
}

.savings-gauge {
    width: 58px;
    height: 58px;
    transform: rotate(-90deg);
}

.circle-bg,
.circle {
    fill: none;
    stroke-width: 3.5;
}

.circle-bg {
    stroke: var(--border-color);
}

.circle {
    stroke: var(--color-success);
    stroke-linecap: round;
    transition: stroke-dasharray 0.25s var(--ease);
}

.skipped-breakdown {
    display: grid;
    gap: 3px;
    margin-top: 5px;
}

.skip-item {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.skip-item strong {
    color: var(--text-primary);
}

.sidebar-panel {
    grid-column: span 4;
    display: grid;
    gap: 16px;
    align-content: start;
}

.detail-panel {
    grid-column: span 8;
    display: grid;
    gap: 16px;
    align-content: start;
}

.panel-card {
    overflow: hidden;
}

.card-header {
    min-height: 58px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 0.95rem;
    letter-spacing: 0;
}

.card-header .btn-text {
    margin-left: auto;
}

.card-body {
    padding: 16px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 9px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.checkbox-grid {
    display: grid;
    gap: 9px;
}

.checkbox-container {
    position: relative;
    min-height: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 30px;
    color: var(--text-primary);
    font-size: 0.87rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
}

.checkbox-container input:checked ~ .checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-container input:checked ~ .checkmark::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #06110e;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.re-mode {
    align-items: flex-start;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.re-mode strong,
.re-mode em {
    display: block;
}

.re-mode em {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: normal;
}

.btn {
    gap: 8px;
    min-height: 38px;
    justify-content: center;
    padding: 9px 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-weight: 800;
    transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--border-strong);
}

.btn-primary {
    color: #07110f;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-success {
    color: #06110a;
    background: var(--color-success);
    border-color: var(--color-success);
}

.btn-outline {
    background: transparent;
}

.btn-sm {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-text {
    color: var(--color-primary);
    background: transparent;
    border: 0;
    font-weight: 800;
}

.search-header {
    display: grid;
    gap: 10px;
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-control,
.form-control,
.form-control-sm {
    width: 100%;
    min-height: 38px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
}

.search-control {
    padding: 9px 12px 9px 38px;
}

.form-control,
.form-control-sm {
    padding: 8px 10px;
}

.search-control:focus,
.form-control:focus,
.form-control-sm:focus {
    border-color: var(--color-primary);
}

.show-static-toggle {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.request-list-card {
    min-height: 420px;
}

.request-list {
    max-height: 530px;
    overflow: auto;
    padding: 10px;
    display: grid;
    gap: 7px;
}

.req-item {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
}

.req-item:hover,
.req-item.active {
    background: var(--bg-input);
    border-color: var(--border-color);
}

.req-item.active {
    border-color: var(--color-primary);
}

.req-item.static-resource {
    opacity: 0.58;
}

.req-method,
.req-status,
.timeline-time,
.timeline-method,
.preview-line-numbers,
.preview-pre code,
.detail-section code,
.dep-list-item,
.dep-name {
    font-family: var(--font-mono);
}

.req-method {
    min-width: 48px;
    padding: 3px 6px;
    border-radius: 5px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 800;
}

.method-GET { color: var(--color-success); background: var(--color-success-soft); }
.method-POST { color: var(--color-secondary); background: var(--color-secondary-soft); }
.method-PUT { color: var(--color-warning); background: var(--color-warning-soft); }
.method-PATCH { color: var(--color-primary); background: var(--color-primary-soft); }
.method-DELETE { color: var(--color-error); background: var(--color-error-soft); }

.req-url-group {
    min-width: 0;
}

.req-url,
.req-host {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.req-url {
    font-size: 0.83rem;
    font-weight: 800;
}

.req-host {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.req-status {
    font-size: 0.74rem;
}

.status-2xx { color: var(--color-success); }
.status-3xx { color: var(--color-secondary); }
.status-4xx { color: var(--color-warning); }
.status-5xx { color: var(--color-error); }

.tabs-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tabs {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 12px;
    color: var(--text-secondary);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-weight: 800;
}

.tab-btn.active {
    color: #06110e;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.no-selection-state {
    min-height: 520px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    text-align: center;
    color: var(--text-secondary);
    padding: 34px;
}

.no-selection-state svg {
    width: 42px;
    height: 42px;
    color: var(--color-primary);
}

.no-selection-state h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.no-selection-state p {
    max-width: 420px;
}

.compare-view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.compare-column {
    overflow: hidden;
}

.original-column {
    border-left: 3px solid var(--color-error);
}

.filtered-column {
    border-left: 3px solid var(--color-success);
}

.column-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.column-header h3 {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    word-break: break-all;
}

.column-body {
    max-height: 760px;
    overflow: auto;
    padding: 14px;
    display: grid;
    gap: 14px;
}

.detail-section h4,
.re-flow-body h3 {
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-section pre,
.code-preview-window {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.detail-section pre {
    max-height: 260px;
    overflow: auto;
    padding: 12px;
}

.detail-section code,
.preview-pre code {
    color: #dce8e4;
    font-size: 0.78rem;
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}

.raw-preview-container {
    overflow: hidden;
}

.preview-header-bar {
    min-height: 58px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.format-select-wrapper,
.preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.format-select-wrapper label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 800;
}

.code-preview-window {
    height: 760px;
    display: flex;
    overflow: hidden;
    border: 0;
    border-radius: 0;
}

.preview-line-numbers {
    min-width: 48px;
    padding: 14px 8px;
    color: var(--text-muted);
    text-align: right;
    border-right: 1px solid var(--border-color);
    user-select: none;
    overflow: hidden;
}

.preview-pre {
    flex: 1;
    overflow: auto;
    padding: 14px;
}

.re-flow-body {
    display: grid;
    gap: 22px;
}

.timeline-container {
    display: grid;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
}

.timeline-item {
    position: relative;
    display: grid;
    gap: 6px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -21px;
    top: 8px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-primary);
}

.timeline-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.timeline-time,
.timeline-latency {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.timeline-path {
    font-weight: 800;
    word-break: break-all;
}

.timeline-actions-list {
    display: grid;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.timeline-action-tag {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.dependency-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.dependency-card {
    padding: 12px;
    border-radius: var(--radius);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
}

.dependency-card-header,
.dep-info-row {
    display: grid;
    gap: 4px;
}

.dependency-card-header {
    grid-template-columns: 1fr auto;
    align-items: center;
    margin-bottom: 10px;
}

.dep-info-row {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.dep-list {
    display: grid;
    gap: 3px;
}

.dynamic-checkbox-list {
    max-height: 150px;
    overflow: auto;
    display: grid;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
}

.range-slider {
    width: 100%;
}

.toast-container {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 60;
    display: grid;
    gap: 10px;
}

.toast {
    min-width: 280px;
    max-width: min(420px, calc(100vw - 36px));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    color: var(--text-primary);
    background: var(--bg-panel-strong);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    animation: toast-in 0.24s var(--ease);
}

.toast-success { border-left: 3px solid var(--color-success); }
.toast-error { border-left: 3px solid var(--color-error); }
.toast-warning { border-left: 3px solid var(--color-warning); }
.toast-info { border-left: 3px solid var(--color-secondary); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

@media (max-width: 1100px) {
    .tool-hero,
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .sidebar-panel,
    .detail-panel {
        grid-column: span 12;
    }

    .compare-view-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100vw - 28px, 1440px);
    }

    .header-container {
        height: auto;
        min-height: 68px;
        grid-template-columns: 1fr auto;
        padding: 10px 0;
    }

    .brand-lockup {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .back-link {
        grid-row: 2;
    }

    .header-actions {
        grid-row: 2;
    }

    .app-main {
        padding-top: 20px;
    }

    .tool-hero h2 {
        font-size: clamp(1.9rem, 9vw, 2.55rem);
        line-height: 1.04;
        letter-spacing: -0.025em;
    }

    .tool-hero {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        overflow: hidden;
    }

    .tool-hero > *,
    .tool-hero p,
    .drop-zone-content,
    .drop-zone-content > div {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .tool-hero p {
        font-size: 0.92rem;
    }

    .drop-zone-content {
        padding: 24px 14px;
    }

    .stat-card {
        grid-template-columns: auto 1fr;
    }

    .savings-gauge {
        display: none;
    }

    .tabs-container,
    .preview-header-bar,
    .capture-strip {
        flex-direction: column;
        align-items: stretch;
    }

    .tabs,
    .preview-actions,
    .format-select-wrapper {
        width: 100%;
    }

    .tab-btn,
    .preview-actions .btn,
    .format-select-wrapper select {
        flex: 1;
    }

    .req-item {
        grid-template-columns: auto 1fr auto;
    }

    .req-action-wrapper {
        display: none;
    }
}

@media (max-width: 520px) {
    .container {
        width: min(362px, calc(100vw - 28px));
        margin-left: 14px;
        margin-right: auto;
    }
}

/* Clean copy pass */
.brand-lockup p,
.tool-hero p,
.drop-zone p,
.file-limits-info {
    display: none;
}

.tool-hero {
    display: block;
    margin-bottom: 14px;
}

.tool-hero h2 {
    max-width: 720px;
}

.drop-zone {
    min-height: 220px;
}

.drop-zone-content {
    gap: 14px;
}

.upload-icon-wrapper {
    width: 58px;
    height: 58px;
}

@media (max-width: 760px) {
    .tool-hero {
        display: block;
    }

    .drop-zone {
        min-height: 250px;
    }
}

/* Compact interface + output controls polish */
.header-container {
    height: 60px;
}

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

.app-main {
    padding: 22px 0 34px;
}

.eyebrow {
    margin-bottom: 6px;
    font-size: 0.68rem;
}

.tool-hero {
    margin-bottom: 10px;
}

.tool-hero h2 {
    font-size: clamp(1.8rem, 4.2vw, 3.8rem);
}

.drop-zone {
    min-height: 170px;
}

.drop-zone-content {
    gap: 10px;
    padding: 18px;
}

.upload-icon-wrapper {
    width: 48px;
    height: 48px;
}

.upload-icon-wrapper svg {
    width: 24px;
    height: 24px;
}

.drop-zone h2 {
    font-size: clamp(1.1rem, 2.2vw, 1.55rem);
}

.workspace-grid,
.dashboard-stats,
.sidebar-panel,
.detail-panel {
    gap: 12px;
}

.stat-card {
    min-height: 88px;
    padding: 12px;
}

.stat-icon {
    width: 36px;
    height: 36px;
}

.stat-value,
.stat-details .stat-value {
    font-size: 1.28rem;
}

.card-header {
    min-height: 48px;
    padding: 10px 12px;
}

.card-body,
.column-body {
    padding: 12px;
}

.request-list-card {
    min-height: 340px;
}

.request-list {
    max-height: 430px;
}

.no-selection-state {
    min-height: 420px;
}

.column-body,
.code-preview-window {
    max-height: 620px;
}

.raw-preview-container {
    border-color: rgba(125, 211, 190, 0.18);
}

.preview-header-bar {
    min-height: 50px;
    padding: 10px;
}

.format-select-wrapper {
    min-width: min(360px, 100%);
}

.format-select-wrapper label {
    white-space: nowrap;
}

.form-control-sm,
#output-format-select {
    min-height: 36px;
    color: #eaf7f3 !important;
    background: #111619 !important;
    border-color: rgba(125, 211, 190, 0.28) !important;
}

#output-format-select option {
    color: #111619;
    background: #ffffff;
}

body.light-theme .form-control-sm,
body.light-theme #output-format-select {
    color: #111619 !important;
    background: #ffffff !important;
    border-color: rgba(18, 21, 24, 0.2) !important;
}

#btn-download-file {
    min-width: 112px;
    color: #06110a !important;
    background: var(--color-success) !important;
    border-color: var(--color-success) !important;
}

#btn-copy-code {
    min-width: 76px;
}

.code-preview-window {
    height: 620px;
}

@media (max-width: 760px) {
    .header-container {
        min-height: 58px;
    }

    .tool-hero h2 {
        font-size: clamp(1.55rem, 8vw, 2.2rem);
    }

    .drop-zone {
        min-height: 190px;
    }

    .preview-actions .btn {
        min-width: 0;
    }
}

/* Smaller HarClean surface */
.header-container {
    height: 54px;
}

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

.brand-lockup h1 {
    font-size: 1rem;
}

.app-main {
    padding-top: 16px;
}

.eyebrow {
    margin-bottom: 4px;
}

.tool-hero {
    margin-bottom: 8px;
}

.tool-hero h2 {
    font-size: clamp(1.35rem, 3vw, 2.35rem);
    line-height: 1.02;
    letter-spacing: -0.025em;
}

.upload-card {
    padding: 6px;
}

.drop-zone {
    min-height: 120px;
}

.drop-zone-content {
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
}

.upload-icon-wrapper {
    width: 38px;
    height: 38px;
}

.upload-icon-wrapper svg {
    width: 20px;
    height: 20px;
}

.drop-zone h2 {
    font-size: 1.08rem;
}

.dashboard-stats {
    gap: 10px;
}

.stat-card {
    min-height: 74px;
    padding: 10px;
}

.stat-icon {
    width: 32px;
    height: 32px;
}

.stat-details h3 {
    font-size: 0.68rem;
}

.stat-value,
.stat-details .stat-value {
    font-size: 1.08rem;
}

.savings-gauge {
    width: 44px;
    height: 44px;
}

.tabs-container {
    align-items: center;
}

.workspace-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

#btn-download-file-top,
#btn-download-file {
    min-width: 118px;
    color: #06110a !important;
    background: var(--color-success) !important;
    border-color: var(--color-success) !important;
}

.card-header {
    min-height: 42px;
}

.request-list-card {
    min-height: 300px;
}

.request-list {
    max-height: 360px;
}

.no-selection-state {
    min-height: 340px;
}

.code-preview-window {
    height: 500px;
}

.column-body {
    max-height: 540px;
}

@media (max-width: 760px) {
    .tool-hero h2 {
        font-size: clamp(1.35rem, 7vw, 1.9rem);
    }

    .drop-zone {
        min-height: 138px;
    }

    .drop-zone-content {
        grid-template-columns: 1fr;
    }

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

    .workspace-actions .btn {
        flex: 1;
    }
}

/* Final visibility fixes */
.tool-hero {
    display: none !important;
}

.preview-header-bar {
    display: grid !important;
    grid-template-columns: minmax(240px, 1fr) auto;
    align-items: center;
}

.preview-actions {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
}

#btn-download-file-top,
#btn-download-file {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (max-width: 760px) {
    .preview-header-bar {
        grid-template-columns: 1fr;
    }

    .preview-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    #btn-download-file {
        width: 100%;
    }
}

