:root {
    --bg: #07111f;
    --panel: rgba(10, 18, 33, 0.74);
    --line: rgba(255, 255, 255, 0.08);
    --text: #edf2f7;
    --muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-2: #06b6d4;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 24px;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.18), transparent 26%),
        radial-gradient(circle at top right, rgba(6, 182, 212, 0.16), transparent 22%),
        linear-gradient(180deg, #040914 0%, #091321 100%);
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

/* HEADER */

.topbar {
    width: min(1280px, calc(100% - 24px));
    margin: 18px auto 0;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(5, 12, 24, 0.78);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
    position: sticky;
    top: 12px;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.brand strong {
    display: block;
}

.brand small {
    color: var(--muted);
    font-size: 0.82rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav a {
    padding: 11px 12px;
    border-radius: 14px;
    color: #dbe7f5;
    transition: 0.2s ease;
    font-size: 0.94rem;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nav-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white !important;
    font-weight: 700;
}

.logout-link {
    color: #fecaca !important;
}

.menu-toggle {
    display: none;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: white;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
}

/* LAYOUT */

.page {
    width: min(1280px, calc(100% - 24px));
    margin: 22px auto 36px;
}

.hero-section {
    min-height: 430px;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
}

.hero-copy,
.hero-panel,
.page-banner,
.section,
.detail-card,
.collector-form,
.auth-card {
    border: 1px solid var(--line);
    background: var(--panel);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-copy {
    padding: 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.eyebrow {
    display: inline-block;
    width: fit-content;
    margin-bottom: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    font-size: 0.82rem;
    border: 1px solid var(--line);
}

.hero-copy h1 {
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 1.05;
    margin-bottom: 16px;
}

.hero-copy p,
.page-banner p {
    color: var(--muted);
    line-height: 1.7;
    font-size: 1.03rem;
}

.hero-actions,
.form-actions,
.detail-actions,
.row-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.btn,
.mini-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn {
    padding: 14px 18px;
    border-radius: 16px;
}

.mini-btn {
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    border: 1px solid var(--line);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
}

.btn-secondary {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.danger {
    background: rgba(239, 68, 68, 0.14) !important;
    color: #fecaca !important;
    border-color: rgba(239, 68, 68, 0.28) !important;
}

.btn:hover,
.mini-btn:hover {
    transform: translateY(-1px);
    opacity: 0.97;
}

/* HERO */

.hero-panel {
    padding: 20px;
    display: grid;
    gap: 16px;
    align-content: center;
}

.stat-card {
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid var(--line);
}

.stat-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 2rem;
}

/* SECTIONS */

.section {
    margin-top: 24px;
    padding: 22px;
}

.section-head,
.page-banner {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.section-head {
    margin-bottom: 18px;
}

.section-head h2,
.page-banner h1 {
    font-size: clamp(1.5rem, 3vw, 2.3rem);
    margin-bottom: 8px;
}

.page-banner {
    padding: 26px;
}

.filter-box {
    min-width: 280px;
}

.filter-box label,
.field label {
    display: block;
    font-size: 0.9rem;
    color: #d8e2ef;
    margin-bottom: 8px;
}

.filter-box select,
.field input,
.field select,
.field textarea {
    width: 100%;
    background: rgba(4, 10, 20, 0.72);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    outline: none;
}

.field textarea {
    resize: vertical;
    min-height: 120px;
}

.hint {
    color: var(--muted);
    margin-top: 6px;
}

/* CARDS */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.piece-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    transition: 0.22s ease;
}

.piece-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.16);
}

.piece-image-wrap {
    position: relative;
    height: 240px;
    overflow: hidden;
    background: #0b1220;
}

.piece-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trade-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.16);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.28);
    font-size: 0.8rem;
    backdrop-filter: blur(8px);
}

.owner-chip {
    margin-left: auto;
    color: #c4b5fd;
    font-size: 0.82rem;
}

.piece-body {
    padding: 18px;
}

.piece-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
    font-size: 0.92rem;
    margin-bottom: 12px;
}

.category-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.piece-body h3 {
    font-size: 1.15rem;
    margin-bottom: 10px;
}

.piece-body p {
    color: var(--muted);
    line-height: 1.55;
    min-height: 72px;
}

.piece-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.tag,
.estado {
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.estado.excelente {
    background: rgba(34, 197, 94, 0.14);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.28);
}

.estado.bueno {
    background: rgba(59, 130, 246, 0.14);
    color: #bfdbfe;
    border-color: rgba(59, 130, 246, 0.28);
}

.estado.regular {
    background: rgba(245, 158, 11, 0.14);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.28);
}

.card-actions {
    margin-top: 16px;
}

/* FORM */

.collector-form {
    padding: 26px;
}

.collector-form.compact {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.field-full {
    grid-column: 1 / -1;
}

.switch-label {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
}

.switch-label input {
    width: auto !important;
}

.form-message {
    margin-top: 14px;
    color: #cbd5e1;
}

.form-message.success {
    color: #86efac;
}

/* TABLE */

.table-wrap {
    overflow: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

.modern-table th,
.modern-table td {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.modern-table th {
    color: #cbd5e1;
    font-size: 0.9rem;
}

.table-piece {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-piece img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 14px;
}

.table-piece small {
    display: block;
    color: var(--muted);
}

/* DETAIL */

.detail-card {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.detail-image-wrap {
    border-radius: 22px;
    overflow: hidden;
    background: #0b1220;
    min-height: 420px;
}

.detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-body h1 {
    font-size: clamp(1.8rem, 3vw, 3rem);
    margin: 12px 0;
}

.detail-description {
    color: var(--muted);
    line-height: 1.75;
    margin-bottom: 22px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.detail-item {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.detail-item span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

/* EXCHANGES */

.proposal-layout {
    display: grid;
    grid-template-columns: 0.8fr 1fr;
    gap: 20px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.tab {
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
}

.tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    font-weight: 700;
}

.exchange-list {
    display: grid;
    gap: 14px;
}

.exchange-card {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
}

.exchange-card h3 {
    margin: 12px 0;
}

.exchange-card p {
    color: var(--muted);
    line-height: 1.6;
}

/* AUTH */

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.auth-card {
    width: min(440px, 100%);
    padding: 30px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 22px;
}

.auth-brand .brand-icon {
    margin: 0 auto 12px;
}

.auth-brand h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.auth-brand p,
.auth-link {
    color: var(--muted);
}

.auth-link {
    text-align: center;
    margin-top: 18px;
}

.auth-link a {
    color: #c4b5fd;
    font-weight: 700;
}

/* EMPTY */

.empty-box {
    padding: 24px;
    border: 1px dashed var(--line);
    border-radius: 20px;
    color: var(--muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
}

/* FOOTER */

.footer {
    width: min(1280px, calc(100% - 24px));
    margin: 0 auto 30px;
    padding: 16px;
    text-align: center;
    color: var(--muted);
}

/* RESPONSIVE */

@media (max-width: 980px) {
    .hero-section,
    .detail-card,
    .proposal-layout {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-banner,
    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-box {
        width: 100%;
        min-width: 100%;
    }
}

@media (max-width: 760px) {
    .menu-toggle {
        display: block;
    }

    .nav {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        left: 0;
        width: min(1280px, calc(100% - 24px));
        margin: auto;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 20px;
        background: rgba(5, 12, 24, 0.97);
        backdrop-filter: blur(14px);
        display: none;
        flex-direction: column;
        align-items: stretch;
    }

    .nav.open {
        display: flex;
    }

    .hero-copy {
        padding: 28px;
    }

    .section,
    .page-banner,
    .collector-form,
    .detail-card {
        padding: 18px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .exchange-card {
        flex-direction: column;
    }
}