/* ==========================================================================
   Products & Services Module Overlay (#79)
   Scoped to .psv-shell — does NOT alter global selectors.
   Mirrors the brand-green pill pattern established in tenants / concerns.
   ========================================================================== */

.psv-shell {
    --brand-green: var(--brand-primary);
    --psv-radius: 14px;
    --psv-divider: 1px dashed color-mix(in srgb, var(--brand-green) 22%, transparent);
    --psv-elev: 0 1px 0 rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.04);
    color: var(--text-primary);
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.psv-shell .psv-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    margin-bottom: 1rem;
    background: var(--surface-1);
    border-radius: var(--psv-radius);
    box-shadow: var(--psv-elev);
    border-bottom: var(--psv-divider);
}
.psv-shell .psv-page-header h1 {
    font-size: 1.4rem;
    margin: 0 0 .25rem;
    color: var(--text-primary);
}
.psv-shell .psv-page-header .psv-subtitle {
    font-size: .875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ── Brand-green pill CTA ────────────────────────────────────────────────── */
.psv-shell .psv-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--brand-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 7px 18px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    text-decoration: none;
    white-space: nowrap;
}
.psv-shell .psv-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.15);
    background: var(--brand-primary-hover);
    color: #fff;
}
.psv-shell .psv-pill:active { transform: translateY(0); }
.psv-shell .psv-pill[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ── Card surface ────────────────────────────────────────────────────────── */
.psv-shell .psv-card {
    background: var(--surface-1);
    border-radius: var(--psv-radius);
    box-shadow: var(--psv-elev);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.psv-shell .psv-card-bd { padding: 0; }

/* ── Sunken sticky uppercase table headers ───────────────────────────────── */
.psv-shell .psv-table-wrap {
    border-radius: var(--psv-radius);
    overflow: hidden;
    background: var(--surface-1);
    box-shadow: var(--psv-elev);
}
.psv-shell .psv-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}
.psv-shell .psv-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-2, #f1f3f5);
    color: var(--text-secondary);
    font-size: .72rem;
    letter-spacing: .055em;
    text-transform: uppercase;
    font-weight: 700;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border-1, #e3e6ea);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.04);
    text-align: left;
}
.psv-shell .psv-table tbody td {
    padding: .85rem 1rem;
    border-bottom: 1px dashed var(--border-1, #eef0f3);
    vertical-align: middle;
    font-size: .9rem;
}
.psv-shell .psv-table tbody tr {
    transition: background .15s ease, transform .15s ease;
}
.psv-shell .psv-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand-green) 4%, transparent);
}
.psv-shell .psv-table tbody tr:last-child td { border-bottom: none; }
.psv-shell .psv-table tfoot td { padding: .85rem 1rem; font-weight: 600; }

/* ── Pills (status / category / pricing) ─────────────────────────────────── */
.psv-shell .psv-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
    line-height: 1.4;
    white-space: nowrap;
}
.psv-shell .psv-tag.is-active   { background: rgba(40,167,69,.12);  color: #1e7d34; }
.psv-shell .psv-tag.is-inactive { background: rgba(108,117,125,.15); color: #5a6268; }
.psv-shell .psv-tag.is-protected{ background: rgba(255,193,7,.18);   color: #8a6d00; }
.psv-shell .psv-tag.is-cat      { background: rgba(13,110,253,.12);  color: #0a58ca; }
.psv-shell .psv-tag.is-pricing  { background: rgba(111,66,193,.12);  color: #58359a; }

/* "System" pill — mandatory items that cannot be deleted/deactivated */
.psv-shell .psv-tag.is-system {
    background: linear-gradient(135deg, rgba(255,193,7,.16) 0%, rgba(255,167,0,.18) 100%);
    color: #7a5a00;
    border: 1px solid rgba(255,193,7,.42);
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    cursor: help;
}
.psv-shell .psv-tag.is-system i { font-size: .65rem; }

/* Info banner sitting between header and table — explains system items */
.psv-shell .psv-info-banner {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .7rem 1rem;
    margin-bottom: 1rem;
    background: color-mix(in srgb, var(--brand-green) 6%, transparent);
    border-left: 3px solid var(--brand-green);
    border-radius: 10px;
    font-size: .85rem;
    color: var(--text-secondary);
}
.psv-shell .psv-info-banner i {
    color: var(--brand-green);
    font-size: 1rem;
    margin-top: .15rem;
}
.psv-shell .psv-info-banner strong { color: var(--text-primary); }

/* ── Discount cross-link pill (clickable) ────────────────────────────────── */
.psv-shell .psv-discount-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(220,53,69,.10);
    color: #b02a37;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s ease, transform .15s ease;
    text-decoration: none;
    margin-right: 4px;
}
.psv-shell .psv-discount-pill:hover {
    background: rgba(220,53,69,.18);
    transform: translateY(-1px);
    color: #842029;
}
.psv-shell .psv-discount-pill.is-empty {
    background: transparent;
    color: var(--text-muted, #888);
    border: 1px dashed color-mix(in srgb, var(--text-muted, #888) 40%, transparent);
    cursor: default;
}
.psv-shell .psv-discount-pill.is-empty:hover { transform: none; background: transparent; }

/* ── Usage cross-link pill ───────────────────────────────────────────────── */
.psv-shell .psv-usage-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: 3px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand-green) 10%, transparent);
    color: var(--brand-green);
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.psv-shell .psv-usage-pill:hover {
    background: color-mix(in srgb, var(--brand-green) 18%, transparent);
    transform: translateY(-1px);
}
.psv-shell .psv-usage-pill.is-empty {
    background: transparent;
    color: var(--text-muted, #888);
    border: 1px dashed color-mix(in srgb, var(--text-muted, #888) 40%, transparent);
    cursor: default;
}

/* ── Action icon-buttons row ─────────────────────────────────────────────── */
.psv-shell .psv-actions {
    display: inline-flex;
    gap: .35rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}
.psv-shell .psv-icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-1, #dee2e6);
    background: var(--surface-1);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .15s ease;
    font-size: .85rem;
}
.psv-shell .psv-icon-btn:hover {
    background: var(--brand-green);
    color: #fff;
    border-color: var(--brand-green);
    transform: translateY(-1px);
}
.psv-shell .psv-icon-btn.is-danger:hover { background: #dc3545; border-color: #dc3545; }

/* ── Mobile: stack header + scroll table ─────────────────────────────────── */
@media (max-width: 640px) {
    .psv-shell .psv-page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .psv-shell .psv-table thead th,
    .psv-shell .psv-table tbody td { padding: .65rem .6rem; font-size: .82rem; }
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
[data-theme="dark"] .psv-shell .psv-table thead th {
    background: rgba(255,255,255,.04);
    color: var(--text-secondary);
}
[data-theme="dark"] .psv-shell .psv-discount-pill { background: rgba(220,53,69,.18); color: #ff6b78; }
[data-theme="dark"] .psv-shell .psv-usage-pill {
    background: color-mix(in srgb, var(--brand-green) 22%, transparent);
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .psv-shell .psv-pill,
    .psv-shell .psv-icon-btn,
    .psv-shell .psv-discount-pill,
    .psv-shell .psv-usage-pill,
    .psv-shell .psv-table tbody tr { transition: none; }
}

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
    .psv-shell .psv-pill,
    .psv-shell .psv-actions { display: none !important; }
    .psv-shell .psv-table thead th { background: #fff !important; color: #000 !important; }
}
