.tejido-page {
    --tejido-bg: #181715;
    --tejido-panel: #22211f;
    --tejido-panel-2: #292825;
    --tejido-line: rgba(237, 183, 129, .2);
    --tejido-gold: #edb781;
    --tejido-terra: #cd734f;
    --tejido-sage: #b4c995;
    --tejido-teal: #add4d9;
    max-width: 1440px;
    margin: 0 auto;
    padding: 42px 24px 56px;
    color: #f4efe7;
}

.tejido-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    padding: 26px 0 30px;
    border-bottom: 1px solid var(--tejido-line);
}

.tejido-hero__actions {
    display: flex;
    align-items: flex-end;
    gap: 14px;
}

.tejido-mode-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(237, 183, 129, .28);
    background: #1d1c1a;
}

.tejido-mode-switch a {
    padding: 8px 12px;
    color: rgba(244, 239, 231, .7);
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
}

.tejido-mode-switch a.is-active {
    background: #cd734f;
    color: #fff;
}

.tejido-readonly {
    display: flex;
    align-items: center;
    height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 3px;
    background: var(--tejido-panel-2);
    color: rgba(244, 239, 231, .78);
}

.tejido-kicker {
    display: block;
    margin-bottom: 10px;
    color: var(--tejido-gold);
    font: 700 .72rem/1.3 "Inter", sans-serif;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.tejido-hero h1 {
    margin: 0;
    color: #fffaf2;
    font: 700 clamp(2.2rem, 5vw, 4.7rem)/.98 "Plus Jakarta Sans", sans-serif;
    letter-spacing: -.055em;
}

.tejido-hero p {
    max-width: 720px;
    margin: 18px 0 0;
    color: rgba(244, 239, 231, .68);
    font-size: clamp(1rem, 1.5vw, 1.18rem);
    line-height: 1.65;
}

.tejido-hero__mark {
    display: grid;
    width: 92px;
    height: 92px;
    flex: 0 0 92px;
    place-items: center;
    border: 1px solid var(--tejido-line);
    color: var(--tejido-gold);
    font-size: 2rem;
}

.tejido-workspace {
    margin-top: 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .09);
    background: var(--tejido-panel);
}

.tejido-toolbar {
    display: grid;
    grid-template-columns: minmax(170px, 220px) minmax(210px, 1fr) auto auto;
    gap: 14px;
    align-items: end;
    padding: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: #1d1c1a;
}

.tejido-field label {
    display: block;
    margin-bottom: 7px;
    color: rgba(244, 239, 231, .56);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tejido-field select,
.tejido-field input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 3px;
    outline: none;
    background: var(--tejido-panel-2);
    color: #f7f1e8;
}

.tejido-field select:focus,
.tejido-field input:focus {
    border-color: var(--tejido-gold);
}

.tejido-reset {
    height: 42px;
    padding: 0 16px;
    border: 1px solid rgba(237, 183, 129, .38);
    border-radius: 3px;
    background: transparent;
    color: var(--tejido-gold);
    font-weight: 700;
}

.tejido-reset:hover {
    background: rgba(237, 183, 129, .08);
}

.tejido-stats {
    align-self: center;
    padding-top: 18px;
    color: rgba(244, 239, 231, .55);
    font-size: .85rem;
    white-space: nowrap;
}

.tejido-stats strong {
    color: #fff;
}

.tejido-stage-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    min-height: 680px;
}

.tejido-stage {
    position: relative;
    min-height: 680px;
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px),
        #181715;
    background-size: 44px 44px;
}

#tejido-graph {
    display: block;
    width: 100%;
    height: 680px;
    cursor: grab;
    touch-action: none;
}

#tejido-graph:active {
    cursor: grabbing;
}

.tejido-edge {
    stroke: rgba(237, 183, 129, .24);
    stroke-linecap: round;
    transition: opacity .2s, stroke .2s;
}

.tejido-node circle {
    cursor: pointer;
    stroke: rgba(24, 23, 21, .92);
    stroke-width: 3;
    transition: stroke .2s, opacity .2s;
}

.tejido-node text {
    fill: #fffaf2;
    font: 600 11px/1 "Inter", sans-serif;
    pointer-events: none;
    paint-order: stroke;
    stroke: #181715;
    stroke-width: 4px;
    stroke-linejoin: round;
}

.tejido-node.is-active circle,
.tejido-node:hover circle {
    stroke: var(--tejido-gold);
    stroke-width: 5;
}

.tejido-node.is-muted,
.tejido-edge.is-muted {
    opacity: .12;
}

.tejido-loading {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(24, 23, 21, .92);
    color: rgba(244, 239, 231, .66);
}

.tejido-loading span {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(237, 183, 129, .25);
    border-top-color: var(--tejido-gold);
    border-radius: 50%;
    animation: tejido-spin .8s linear infinite;
}

@keyframes tejido-spin {
    to { transform: rotate(360deg); }
}

.tejido-stage__help {
    position: absolute;
    right: 16px;
    bottom: 12px;
    margin: 0;
    color: rgba(244, 239, 231, .42);
    font-size: .72rem;
    pointer-events: none;
}

.tejido-detail {
    padding: 28px 24px;
    border-left: 1px solid rgba(255, 255, 255, .08);
    background: var(--tejido-panel-2);
}

.tejido-detail__empty {
    padding-top: 78px;
    color: rgba(244, 239, 231, .57);
    text-align: center;
}

.tejido-detail__empty i {
    margin-bottom: 18px;
    color: var(--tejido-gold);
    font-size: 1.7rem;
}

.tejido-detail h2 {
    margin: 0 0 8px;
    color: #fffaf2;
    font: 700 1.65rem/1.1 "Plus Jakarta Sans", sans-serif;
    letter-spacing: -.035em;
}

.tejido-detail h3 {
    margin: 25px 0 10px;
    color: var(--tejido-gold);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.tejido-detail p {
    color: rgba(244, 239, 231, .65);
    line-height: 1.6;
}

.tejido-detail__number {
    display: block;
    margin-bottom: 8px;
    color: var(--tejido-terra);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.tejido-detail__original {
    margin: 0 0 18px;
    font-size: .88rem;
}

.tejido-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tejido-tags span {
    padding: 5px 8px;
    border: 1px solid rgba(173, 212, 217, .25);
    border-radius: 2px;
    color: var(--tejido-teal);
    font-size: .72rem;
}

.tejido-tags--accent span {
    border-color: rgba(180, 201, 149, .25);
    color: var(--tejido-sage);
}

.tejido-neighbors {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tejido-neighbors li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    color: rgba(244, 239, 231, .77);
    font-size: .85rem;
}

.tejido-neighbors button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.tejido-neighbors button:hover {
    color: var(--tejido-gold);
}

.tejido-neighbors em {
    color: var(--tejido-gold);
    font-style: normal;
    font-variant-numeric: tabular-nums;
}

.tejido-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 18px;
    padding: 15px 17px;
    border-left: 2px solid var(--tejido-gold);
    background: rgba(237, 183, 129, .055);
}

.tejido-note i {
    margin-top: 4px;
    color: var(--tejido-gold);
}

.tejido-note p {
    margin: 0;
    color: rgba(244, 239, 231, .62);
    font-size: .82rem;
    line-height: 1.55;
}

@media (max-width: 980px) {
    .tejido-toolbar {
        grid-template-columns: 1fr 1fr;
    }
    .tejido-stats {
        padding: 0;
        text-align: right;
    }
    .tejido-stage-wrap {
        grid-template-columns: 1fr;
    }
    .tejido-detail {
        min-height: 280px;
        border-top: 1px solid rgba(255, 255, 255, .08);
        border-left: 0;
    }
    .tejido-detail__empty {
        padding-top: 28px;
    }
}

@media (max-width: 640px) {
    .tejido-page {
        padding: 24px 12px 40px;
    }
    .tejido-hero {
        align-items: flex-start;
    }
    .tejido-hero__mark {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
        font-size: 1.25rem;
    }
    .tejido-toolbar {
        grid-template-columns: 1fr;
    }
    .tejido-stats {
        text-align: left;
    }
    .tejido-stage,
    #tejido-graph {
        min-height: 540px;
        height: 540px;
    }
    .tejido-stage__help {
        left: 12px;
        right: 12px;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tejido-loading span {
        animation: none;
    }
}
