/* ========== Vendor management (redesign) ========== */
.vm-page {
    --vm-primary: #0f766e;
    --vm-primary-dark: #0d5f59;
    --vm-bg: #f8fafc;
    --vm-card: #ffffff;
    --vm-border: #e2e8f0;
    --vm-ink: #0f172a;
    --vm-muted: #64748b;
    --vm-success: #22c55e;
    --vm-warn: #f59e0b;
    max-width: 1280px;
    margin: 0 auto;
    padding-bottom: 5rem;
    background: var(--vm-bg);
}

.vm-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.vm-title {
    margin: 0 0 0.35rem;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--vm-ink);
}

.vm-subtitle {
    margin: 0;
    max-width: 36rem;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--vm-muted);
}

.vm-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.vm-btn-primary {
    background: var(--vm-primary) !important;
    border-color: var(--vm-primary) !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 0.65rem;
    padding: 0.5rem 1rem;
}

.vm-btn-primary:hover {
    background: var(--vm-primary-dark) !important;
    border-color: var(--vm-primary-dark) !important;
}

.vm-btn-ghost {
    background: #fff;
    border: 1px solid var(--vm-border);
    color: var(--vm-ink);
    font-weight: 600;
    border-radius: 0.65rem;
}

.vm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.15rem;
}

.vm-kpi-card {
    background: var(--vm-card);
    border: 1px solid var(--vm-border);
    border-radius: 1rem;
    padding: 1.1rem 1.2rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    border-top: 3px solid var(--vm-primary);
}

.vm-kpi-card--success { border-top-color: var(--vm-success); }
.vm-kpi-card--accent { border-top-color: #6366f1; }
.vm-kpi-card--warn { border-top-color: var(--vm-warn); }

.vm-kpi-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--vm-muted);
}

.vm-kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--vm-ink);
    line-height: 1.1;
}

.vm-card {
    background: var(--vm-card);
    border: 1px solid var(--vm-border);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.15rem;
}

.vm-section-title {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 800;
    color: var(--vm-ink);
}

.vm-section-sub {
    margin: 0;
    font-size: 0.82rem;
    color: var(--vm-muted);
}

.vm-catalog-head { margin-bottom: 0.85rem; }

.vm-section-toggle {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0 0 0.85rem;
    text-align: left;
    cursor: pointer;
    color: inherit;
}

.vm-section-toggle:hover .vm-section-title {
    color: var(--vm-primary);
}

.vm-section-toggle:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.35);
    outline-offset: 3px;
    border-radius: 0.5rem;
}

.vm-section-toggle-text {
    min-width: 0;
    flex: 1;
}

.vm-section-chevron {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #475569;
    margin-top: 0.1rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.vm-section-toggle:hover .vm-section-chevron {
    background: #ccfbf1;
    color: var(--vm-primary);
}

.vm-card.is-collapsed .vm-section-toggle,
.vm-catalog.is-collapsed .vm-section-toggle {
    margin-bottom: 0;
}

.vm-section-body {
    animation: vm-section-reveal 0.2s ease;
}

@keyframes vm-section-reveal {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.vm-list-toolbar--body {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 0.85rem;
}

.vm-catalog-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
    padding: 0.35rem;
    background: #f1f5f9;
    border-radius: 999px;
}

.vm-catalog-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    background: transparent;
    color: var(--vm-muted);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.vm-catalog-tab:hover {
    color: var(--vm-ink);
    background: rgba(255, 255, 255, 0.7);
}

.vm-catalog-tab.is-active {
    background: var(--vm-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.28);
}

.vm-catalog-tab-count {
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    background: rgba(15, 23, 42, 0.08);
}

.vm-catalog-tab.is-active .vm-catalog-tab-count {
    background: rgba(255, 255, 255, 0.22);
}

.vm-service-rows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
    max-height: 14rem;
    overflow: auto;
}

.vm-service-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--vm-border);
    border-radius: 0.65rem;
    background: #fff;
}

.vm-service-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--vm-ink);
}

.vm-service-actions {
    display: inline-flex;
    gap: 0.15rem;
}

.vm-icon-btn {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: var(--vm-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.vm-icon-btn:hover { background: #f1f5f9; color: var(--vm-ink); }
.vm-icon-btn--danger:hover { background: #fef2f2; color: #dc2626; }

.vm-catalog-add {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.vm-catalog-empty {
    margin: 0.5rem 0;
    color: var(--vm-muted);
    font-size: 0.88rem;
}

.vm-list-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.vm-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.vm-search {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: min(16rem, 100%);
    padding: 0.45rem 0.7rem;
    background: #f8fafc;
    border: 1px solid var(--vm-border);
    border-radius: 0.65rem;
    color: var(--vm-muted);
}

.vm-search input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 0.88rem;
    color: var(--vm-ink);
}

.vm-filter {
    width: auto;
    min-width: 8.5rem;
    border-radius: 0.65rem;
}

.vm-table {
    --bs-table-bg: transparent;
}

.vm-table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--vm-muted);
    font-weight: 800;
    border-bottom-width: 1px;
    background: #f8fafc;
    padding: 0.7rem 0.75rem;
    white-space: nowrap;
}

.vm-table tbody td {
    padding: 0.8rem 0.75rem;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.vm-table tbody tr:hover { background: #f8fafc; }
.vm-row--inactive { opacity: 0.72; }
.vm-row--editing { background: #ecfdf5 !important; }

.vm-vendor-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    border: 0;
    background: transparent;
    padding: 0;
    text-align: left;
    cursor: pointer;
}

.vm-vendor-name {
    font-weight: 700;
    color: var(--vm-primary);
}

.vm-vendor-link:hover .vm-vendor-name { text-decoration: underline; }

.vm-vendor-meta {
    font-size: 0.75rem;
    color: var(--vm-muted);
}

.vm-cat-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.vm-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
}

.vm-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
}

.vm-status--active {
    background: #dcfce7;
    color: #166534;
}
.vm-status--active .vm-status-dot { background: var(--vm-success); }

.vm-status--inactive {
    background: #fee2e2;
    color: #991b1b;
}
.vm-status--inactive .vm-status-dot { background: #ef4444; }

.vm-empty {
    text-align: center;
    padding: 2.5rem 1.25rem;
    color: var(--vm-muted);
}

.vm-empty .bi {
    font-size: 2.25rem;
    color: var(--vm-primary);
    opacity: 0.75;
}

.vm-empty h3 {
    margin: 0.75rem 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--vm-ink);
}

.vm-empty p {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.vm-fab {
    position: fixed;
    right: 1.25rem;
    bottom: 5.5rem;
    z-index: 1050;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1.1rem;
    border: 0;
    border-radius: 999px;
    background: var(--vm-primary);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 10px 28px rgba(15, 118, 110, 0.35);
    cursor: pointer;
}

.vm-fab:hover { background: var(--vm-primary-dark); color: #fff; }
.vm-fab .bi { font-size: 1.15rem; }

.vm-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1065;
    background: rgba(15, 23, 42, 0.35);
}

.vm-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1066;
    width: min(380px, 100vw);
    background: #fff;
    box-shadow: -12px 0 36px rgba(15, 23, 42, 0.16);
    display: flex;
    flex-direction: column;
    animation: vm-drawer-in 0.2s ease;
}

@keyframes vm-drawer-in {
    from { transform: translateX(16px); opacity: 0.7; }
    to { transform: translateX(0); opacity: 1; }
}

.vm-drawer-head {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem;
}

.vm-drawer-body {
    padding: 0 1.35rem 1.5rem;
    overflow: auto;
}

.vm-drawer-hero {
    text-align: center;
    margin-bottom: 1.25rem;
}

.vm-drawer-avatar {
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #14b8a6, #0f766e);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
}

.vm-drawer-name {
    margin: 0.75rem 0 0.2rem;
    font-size: 1.2rem;
    font-weight: 800;
}

.vm-drawer-role {
    margin: 0 0 0.55rem;
    color: var(--vm-muted);
    font-size: 0.88rem;
}

.vm-drawer-dl {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
}

.vm-drawer-dl dt {
    margin: 0;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--vm-muted);
    font-weight: 700;
}

.vm-drawer-dl dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
    color: var(--vm-ink);
    word-break: break-word;
}

.vm-drawer-section h3 {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 800;
}

.vm-drawer-services {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
    font-size: 0.88rem;
}

.vm-drawer-actions { margin-top: 1.25rem; }

.vendor-master-page .btn-primary:not(.vendor-grid-btn-edit) {
    background: var(--vm-primary, #0f766e);
    border-color: var(--vm-primary, #0f766e);
}

@media (max-width: 900px) {
    .vm-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 576px) {
    .vm-kpi-grid { grid-template-columns: 1fr 1fr; }
    .vm-fab-label { display: none; }
    .vm-fab { width: 3.25rem; height: 3.25rem; padding: 0; justify-content: center; border-radius: 50%; }
}
