@font-face {
    font-family: "GT Pressura Mono";
    src: url("/fonts/GT-Pressura-LCGV-Mono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "GT Pressura";
    src: url("/fonts/GT-Pressura-LCGV-Mono-Text.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "GT Pressura";
    src: url("/fonts/GT-Pressura-LCGV-Mono-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f1ece1;
    --paper: rgba(255, 251, 243, 0.94);
    --ink: #161412;
    --muted: #6d655c;
    --line: rgba(22, 20, 18, 0.12);
    --accent: #c94a2c;
    --accent-soft: rgba(201, 74, 44, 0.12);
    --good: #2d7b55;
    --warn: #8b5d12;
    --shadow: 0 18px 40px rgba(51, 38, 23, 0.08);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "GT Pressura", "Helvetica Neue", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(201, 74, 44, 0.16), transparent 30%),
        radial-gradient(circle at bottom right, rgba(45, 123, 85, 0.12), transparent 24%),
        linear-gradient(180deg, #f8f3ea 0%, #ece6da 100%);
}

.catalog-table thead {
    display: none;
}

button,
input,
select {
    font: inherit;
}

.sync-page {
    padding: 14px 14px calc(72px + var(--safe-bottom));
}

.page-header {
    display: grid;
    gap: 14px;
    padding: 18px;
    margin-bottom: 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.eyebrow,
.status-label,
.field span,
th,
.search-debug,
.chip,
.metric-label,
.catalog-table td:nth-child(1),
.catalog-table td:nth-child(2),
.catalog-table td:nth-child(8),
.catalog-table td:nth-child(9),
.catalog-table td:nth-child(10) {
    font-family: "GT Pressura Mono", monospace;
    letter-spacing: 0.04em;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--accent);
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1;
}

.subtitle {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.status-card {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid var(--line);
}

.status-value {
    margin-top: 6px;
    font-size: 20px;
    font-weight: 700;
}

.status-meta {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: end;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
}

.summary {
    justify-self: start;
    color: var(--muted);
    font-size: 13px;
}

.layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.catalog-panel {
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.sync-page {
    padding-bottom: calc(72px + var(--safe-bottom));
}

.table-wrap {
    overflow: auto;
    max-height: none;
    padding: 10px;
}

.catalog-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

th,
td {
    padding: 0;
    border-bottom: none;
    vertical-align: top;
    text-align: left;
}

tbody tr {
    display: grid;
    gap: 8px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 18px;
    cursor: pointer;
}

tbody tr:hover {
    background: rgba(201, 74, 44, 0.06);
}

tbody tr.is-selected {
    background: rgba(201, 74, 44, 0.1);
}

.catalog-table td {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 10px;
    font-size: 14px;
    line-height: 1.35;
}

.catalog-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-family: "GT Pressura Mono", monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.catalog-table td:nth-child(3) {
    display: block;
    font-size: 16px;
    font-weight: 700;
}

.catalog-table td:nth-child(3)::before {
    content: none;
}

.catalog-table td:nth-child(1),
.catalog-table td:nth-child(4),
.catalog-table td:nth-child(6),
.catalog-table td:nth-child(7),
.catalog-table td:nth-child(8) {
    display: none;
}

.product-cell {
    min-width: 0;
}

.details-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-card {
    padding: 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-copy {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.button {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff7f2;
    border-radius: 999px;
    min-height: 44px;
    padding: 0 14px;
    cursor: pointer;
}

.button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.button-ghost {
    background: transparent;
    color: var(--accent);
}

.inline-field {
    display: grid;
    gap: 8px;
}

.empty-block {
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 18px;
}

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

.compare-column {
    min-width: 0;
}

.compare-eyebrow {
    margin-bottom: 8px;
    color: var(--muted);
    font-family: "GT Pressura Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.selected-record .record-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
}

.selected-record .record-meta,
.preview-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
}

.metric {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.6);
}

.metric-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
}

.metric-value {
    margin-top: 4px;
    font-size: 15px;
    font-weight: 700;
    word-break: break-word;
}

.search-debug {
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--muted);
}

.results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.66);
}

.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.result-title,
.preview-title {
    font-size: 17px;
    font-weight: 700;
}

.result-meta {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

.result-tags,
.preview-tags,
.sync-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    text-transform: uppercase;
}

.chip-good {
    background: rgba(45, 123, 85, 0.12);
    color: var(--good);
}

.chip-warn {
    background: rgba(139, 93, 18, 0.14);
    color: var(--warn);
}

.preview-image {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    aspect-ratio: 1;
    object-fit: cover;
}

.preview-tracklist {
    margin-top: 14px;
    padding-left: 18px;
    color: var(--muted);
}

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

.network-status {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: calc(38px + var(--safe-bottom));
    padding: 0 14px var(--safe-bottom);
    background: rgba(19, 18, 16, 0.95);
    color: #f8f2e8;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -10px 30px rgba(17, 15, 13, 0.18);
    font-family: "GT Pressura Mono", monospace;
    font-size: 12px;
    letter-spacing: 0.03em;
}

.network-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #7c766c;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
    flex: 0 0 auto;
}

.network-status.is-loading .network-status-dot {
    background: #f0b24f;
    box-shadow: 0 0 0 4px rgba(240, 178, 79, 0.18);
    animation: pulse 1s ease-in-out infinite;
}

.network-status.is-success .network-status-dot {
    background: #47c17b;
    box-shadow: 0 0 0 4px rgba(71, 193, 123, 0.16);
}

.network-status.is-error .network-status-dot {
    background: #ef6a57;
    box-shadow: 0 0 0 4px rgba(239, 106, 87, 0.16);
}

.network-status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.network-status-meta {
    margin-left: auto;
    color: rgba(248, 242, 232, 0.7);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.12);
    }
    100% {
        transform: scale(1);
    }
}

@media (min-width: 760px) {
    .page-header,
    .toolbar {
        grid-template-columns: 1fr;
    }

    .toolbar {
        grid-template-columns: minmax(280px, 1fr) 220px 1fr;
        align-items: end;
    }

    .summary {
        justify-self: end;
    }

    .selected-record .record-meta,
    .preview-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .panel-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .catalog-table td:nth-child(6),
    .catalog-table td:nth-child(7),
    .catalog-table td:nth-child(8) {
        display: grid;
    }
}

@media (min-width: 1040px) {
    .sync-page {
        padding: 24px 24px calc(72px + var(--safe-bottom));
    }

    .page-header {
        display: flex;
        justify-content: space-between;
        gap: 24px;
        padding: 24px;
        margin-bottom: 16px;
    }

    .toolbar,
    .panel-card,
    .catalog-panel {
        border-radius: 20px;
    }

    .layout {
        display: grid;
        grid-template-columns: minmax(0, 1.25fr) minmax(400px, 0.95fr);
        gap: 16px;
        align-items: start;
    }

    .table-wrap {
        max-height: calc(100vh - 250px);
        padding: 0;
    }

    .catalog-table {
        border-collapse: collapse;
        border-spacing: 0;
    }

    .catalog-table thead {
        display: table-header-group;
    }

    tbody tr {
        display: table-row;
        padding: 0;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    th,
    td {
        padding: 12px 10px;
        border-bottom: 1px solid var(--line);
    }

    th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: #fbf7ef;
        font-size: 12px;
        text-transform: uppercase;
        color: var(--muted);
    }

    .catalog-table td,
    .catalog-table td:nth-child(3),
    .catalog-table td:nth-child(6),
    .catalog-table td:nth-child(7),
    .catalog-table td:nth-child(8) {
        display: table-cell;
        font-size: 14px;
        font-weight: 400;
    }

    .catalog-table td::before,
    .catalog-table td:nth-child(3)::before {
        content: none;
    }

    .catalog-table td:nth-child(1),
    .catalog-table td:nth-child(4),
    .catalog-table td:nth-child(6),
    .catalog-table td:nth-child(7),
    .catalog-table td:nth-child(8) {
        display: table-cell;
    }

    .product-cell {
        min-width: 260px;
    }

    .compare-grid {
        gap: 14px;
    }

    .selected-record .record-title {
        font-size: 20px;
    }

    .preview-image {
        max-width: 240px;
    }

    .result-card {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .result-actions {
        display: flex;
        align-items: start;
    }

    .network-status {
        font-size: 12px;
    }
}
