/**
 * Widget presentation.
 *
 * Invariant: the widget never creates a horizontal scrolling area. A wide table has a
 * five-column data budget and switches to the shared compact renderer below 720px.
 * Variants are visual themes only; they do not own responsive behaviour.
 */

.sw,
.sw * {
    box-sizing: border-box;
}

.sw {
    --sw-accent: #1769aa;
    --sw-accent-soft: #eaf3fb;
    --sw-bg: #f5f7fa;
    --sw-card: #fff;
    --sw-ink: #18202a;
    --sw-muted: #667180;
    --sw-line: rgba(24, 32, 42, .12);
    --sw-gutter: 22px;

    container-name: widget;
    container-type: inline-size;
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow-x: clip;
    overflow-y: auto;
    background: var(--sw-bg);
    color: var(--sw-ink);
    font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overscroll-behavior-y: contain;
}

.sw-mobile {
    --sw-gutter: 15px;
}

.sw button,
.sw input {
    font: inherit;
}

.sw button,
.sw a {
    -webkit-tap-highlight-color: transparent;
}

.sw h2,
.sw h3,
.sw h4,
.sw p {
    margin: 0;
}

.sw h2,
.sw h3,
.sw h4 {
    overflow-wrap: anywhere;
    line-height: 1.18;
}

.sw-hero {
    display: grid;
    grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid var(--sw-line);
    background: var(--sw-card);
    padding: 19px var(--sw-gutter);
}

.sw-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.sw-avatar {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    overflow: hidden;
    place-items: center;
    border-radius: 50%;
    background: var(--sw-accent);
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
}

.sw-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sw-who {
    min-width: 0;
}

.sw-who strong,
.sw-who small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sw-who strong {
    font-size: .94rem;
}

.sw-who small,
.sw-count {
    color: var(--sw-muted);
    font-size: .75rem;
}

.sw-heading {
    min-width: 0;
}

.sw-title {
    overflow-wrap: anywhere;
    font-size: 1.42rem;
    letter-spacing: -.035em;
}

.sw-count {
    margin-top: 3px;
}

.sw-hero-call,
.sw-row-action,
.sw-compact-action {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--sw-accent);
    color: #fff;
    font-weight: 750;
    line-height: 1.2;
    padding: 9px 14px;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.sw-search {
    padding: 16px var(--sw-gutter) 12px;
}

.sw-search-input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--sw-line);
    border-radius: 12px;
    outline: 0;
    background: var(--sw-card);
    color: var(--sw-ink);
    padding: 10px 13px;
}

.sw-search-input:focus {
    border-color: var(--sw-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw-accent) 18%, transparent);
}

.sw-tabs {
    display: flex;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 var(--sw-gutter) 16px;
}

.sw-tab {
    display: inline-flex;
    min-width: 0;
    min-height: 35px;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--sw-line);
    border-radius: 999px;
    background: var(--sw-card);
    color: var(--sw-ink);
    padding: 7px 12px;
}

.sw-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sw-tab-count {
    flex: 0 0 auto;
    color: var(--sw-muted);
    font-size: .72rem;
}

.sw-tab.active {
    border-color: var(--sw-accent);
    background: var(--sw-accent);
    color: #fff;
}

.sw-tab.active .sw-tab-count {
    color: inherit;
    opacity: .8;
}

.sw-body,
.sw-compact-body {
    min-width: 0;
    padding: 4px var(--sw-gutter) 22px;
}

.sw-group,
.sw-price-group {
    min-width: 0;
    margin-bottom: 21px;
}

.sw-group-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin: 0 2px 8px;
}

.sw-group-labels h3,
.sw-price-category-title {
    color: var(--sw-accent);
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.sw-group-labels h4,
.sw-price-group-title {
    margin-top: 3px;
    color: var(--sw-muted);
    font-size: .79rem;
    font-weight: 700;
}

.sw-group-count {
    flex: 0 0 auto;
    color: var(--sw-muted);
    font-size: .72rem;
}

/* A real table is rendered only on a wide surface. It always fits its container. */

.sw-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--sw-line);
    border-radius: 15px;
    background: var(--sw-card);
    box-shadow: 0 8px 24px rgba(24, 32, 42, .05);
}

.sw-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.sw-table th,
.sw-table td {
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 11px 12px;
    text-align: left;
    vertical-align: top;
}

.sw-table th {
    border-bottom: 1px solid var(--sw-line);
    background: color-mix(in srgb, var(--sw-bg) 75%, var(--sw-card));
    color: var(--sw-muted);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.sw-table td {
    border-bottom: 1px solid var(--sw-line);
    font-size: .84rem;
}

.sw-table tbody tr:last-child td {
    border-bottom: 0;
}

.sw-table tbody tr:not(.sw-table-detail-row):hover {
    background: var(--sw-accent-soft);
}

.sw-table .sw-col-primary {
    width: 30%;
    font-weight: 700;
}

.sw-table .sw-col-price,
.sw-table .sw-col-secondary_price {
    color: var(--sw-accent);
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.sw-table .sw-col-price {
    width: 15%;
}

.sw-table .sw-col-more {
    width: 112px;
    text-align: right;
}

.sw-table-more {
    min-height: 32px;
    border: 1px solid var(--sw-line);
    border-radius: 8px;
    background: var(--sw-card);
    color: var(--sw-accent);
    font-size: .75rem;
    font-weight: 750;
    padding: 6px 9px;
}

.sw-table-more:hover {
    border-color: var(--sw-accent);
    background: var(--sw-accent-soft);
}

.sw-table-detail-row td {
    background: var(--sw-accent-soft);
    padding: 0;
}

.sw-table-detail-row .sw-item-details {
    border-top: 0;
}

/* One compact row implementation is shared by both views and every theme. */

.sw-price-categories,
.sw-price-rows {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--sw-line);
    border-radius: 15px;
    background: var(--sw-card);
    box-shadow: 0 8px 24px rgba(24, 32, 42, .05);
}

.sw-price-category,
.sw-price-row {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 62px;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--sw-ink);
    padding: 12px 14px;
    text-align: left;
}

.sw-price-category + .sw-price-category,
.sw-price-entry + .sw-price-entry {
    border-top: 1px solid var(--sw-line);
}

.sw-price-category:hover,
.sw-price-row:hover,
.sw-price-row.selected {
    background: var(--sw-accent-soft);
}

.sw-price-row.selected {
    box-shadow: inset 3px 0 0 var(--sw-accent);
}

.sw-price-category-labels,
.sw-price-row-main {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
}

.sw-price-category strong,
.sw-price-category small,
.sw-price-row strong,
.sw-price-row small {
    display: block;
}

.sw-price-row-main > strong {
    display: -webkit-box;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-size: .92rem;
    font-weight: 720;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.sw-price-category-icon {
    display: grid;
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    place-items: center;
    border-radius: 10px;
    background: var(--sw-accent-soft);
    color: var(--sw-accent);
    font-size: .78rem;
    font-weight: 850;
}

.sw-price-category-labels small,
.sw-price-path,
.sw-details-cue {
    margin-top: 3px;
    color: var(--sw-muted);
    font-size: .71rem;
}

.sw-price-path {
    color: var(--sw-accent);
    font-weight: 700;
}

.sw-price-meta {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 4px 7px;
    margin-top: 5px;
}

.sw-meta-chip {
    max-width: 100%;
    overflow-wrap: anywhere;
    color: var(--sw-muted);
    font-size: .7rem;
}

.sw-details-cue {
    color: var(--sw-accent);
    font-weight: 750;
}

.sw-price-chevron {
    flex: 0 0 auto;
    color: var(--sw-muted);
    font-size: 1.45rem;
}

.sw-item-price {
    display: grid;
    max-width: 42%;
    flex: 0 1 auto;
    justify-items: end;
    color: var(--sw-accent);
    font-variant-numeric: tabular-nums;
    line-height: 1.18;
    text-align: right;
}

.sw-item-price strong {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: .94rem;
    font-weight: 820;
}

.sw-item-price small {
    margin-top: 3px;
    color: var(--sw-muted);
    font-size: .66rem;
}

.sw-price-contact strong {
    font-size: .76rem;
}

.sw-item-details {
    display: grid;
    gap: 11px;
    border-top: 1px dashed var(--sw-line);
    background: var(--sw-accent-soft);
    padding: 12px 14px 14px;
}

.sw-details-list {
    display: grid;
    grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr);
    gap: 7px 13px;
    margin: 0;
    font-size: .76rem;
}

.sw-details-list dt {
    color: var(--sw-muted);
    overflow-wrap: anywhere;
}

.sw-details-list dd {
    min-width: 0;
    margin: 0;
    color: var(--sw-ink);
    overflow-wrap: anywhere;
}

.sw-item-details .sw-row-action {
    justify-self: start;
    min-height: 34px;
    font-size: .76rem;
}

.sw-price-backbar {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
}

.sw-price-back {
    display: grid;
    width: 34px;
    min-height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid var(--sw-line);
    border-radius: 50%;
    background: var(--sw-card);
    color: var(--sw-ink);
    font-size: 1.35rem;
}

.sw-price-category-title {
    margin: 0 3px 7px;
}

.sw-price-group-title {
    margin: 0 3px 7px;
}

.sw-compact-footer {
    position: sticky;
    z-index: 3;
    bottom: 0;
    border-top: 1px solid var(--sw-line);
    background: color-mix(in srgb, var(--sw-card) 95%, transparent);
    padding: 9px var(--sw-gutter) max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -9px 25px rgba(24, 32, 42, .08);
}

.sw-compact-picked {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    padding-bottom: 7px;
    color: var(--sw-muted);
    font-size: .71rem;
}

.sw-compact-picked strong {
    min-width: 0;
    overflow: hidden;
    color: var(--sw-ink);
    text-overflow: ellipsis;
}

.sw-compact-picked button {
    min-height: 0;
    margin-left: auto;
    border: 0;
    background: none;
    color: var(--sw-accent);
    padding: 2px;
}

.sw-compact-actions {
    display: grid;
}

.sw-compact-action {
    min-height: 46px;
}

/* Empty state and row cap. */

.sw-empty {
    border: 1px dashed var(--sw-line);
    border-radius: 14px;
    background: var(--sw-card);
    padding: 28px 18px;
    text-align: center;
}

.sw-empty-title {
    font-weight: 750;
}

.sw-empty-hint {
    margin-top: 5px;
    color: var(--sw-muted);
    font-size: .79rem;
}

.sw-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 var(--sw-gutter) 22px;
    color: var(--sw-muted);
    font-size: .76rem;
    text-align: center;
}

.sw-more-button {
    min-height: 36px;
    border: 0;
    border-radius: 9px;
    background: var(--sw-accent);
    color: #fff;
    font-weight: 750;
    padding: 8px 12px;
}

/* Themes: visual decisions only. */

.sw-classic {
    --sw-accent: #1769aa;
    --sw-accent-soft: #eaf3fb;
}

.sw-studio {
    --sw-accent: #6254d9;
    --sw-accent-soft: #efedff;
    --sw-bg: #f7f6fc;
}

.sw-studio .sw-avatar,
.sw-studio .sw-hero-call,
.sw-studio .sw-tab.active,
.sw-studio .sw-row-action,
.sw-studio .sw-compact-action,
.sw-studio .sw-more-button {
    background: linear-gradient(135deg, #6254d9, #9234c8);
}

.sw-studio .sw-table-wrap,
.sw-studio .sw-price-categories,
.sw-studio .sw-price-rows {
    box-shadow: 0 9px 28px rgba(75, 54, 150, .1);
}

.sw-directory {
    --sw-accent: #21644b;
    --sw-accent-soft: #e3eee8;
    --sw-bg: #f2efe7;
    --sw-card: #fffdf7;
    --sw-ink: #202720;
    --sw-muted: #687068;
}

.sw-directory .sw-title,
.sw-directory .sw-group-labels h3,
.sw-directory .sw-price-category-title {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
}

.sw-directory .sw-avatar,
.sw-directory .sw-tab,
.sw-directory .sw-table-wrap,
.sw-directory .sw-price-categories,
.sw-directory .sw-price-rows,
.sw-directory .sw-search-input {
    border-radius: 7px;
}

/* Explicit surfaces and container fallback. */

.sw-wide-only {
    display: block;
}

.sw-narrow-only {
    display: none;
}

.sw-mobile .sw-wide-only {
    display: none;
}

.sw-mobile .sw-narrow-only {
    display: block;
}

@container widget (max-width: 720px) {
    .sw {
        --sw-gutter: 15px;
    }

    .sw-wide-only {
        display: none;
    }

    .sw-narrow-only {
        display: block;
    }

    .sw-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        padding-top: max(15px, env(safe-area-inset-top));
    }

    .sw-heading {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 10px;
    }

    .sw-title {
        font-size: 1.1rem;
    }

    .sw-hero-call {
        display: none;
    }

    .sw-tabs {
        gap: 6px;
    }

    .sw-tab {
        max-width: 100%;
        flex: 1 1 auto;
        justify-content: center;
        border-radius: 9px;
    }

    .sw-price-row {
        align-items: flex-start;
        padding: 12px;
    }

    .sw-item-price {
        max-width: 40%;
    }

    .sw-details-list {
        grid-template-columns: minmax(88px, .7fr) minmax(0, 1.3fr);
    }

    .sw-more {
        align-items: stretch;
        flex-direction: column;
    }
}

@container widget (max-width: 390px) {
    .sw-who small {
        display: none;
    }

    .sw-heading {
        display: block;
    }

    .sw-count {
        margin-top: 2px;
    }

    .sw-price-row {
        gap: 9px;
    }

    .sw-item-price {
        max-width: 38%;
    }

    .sw-meta-chip {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sw * {
        scroll-behavior: auto !important;
    }
}

