﻿/* =========================================================
   ROOT VARIABLES (HubSpot-like design system)
   ========================================================= */

:root {
    --hs-bg: #f5f8fa;
    --hs-surface: #ffffff;
    --hs-border: #dfe3eb;
    --hs-border-soft: #e6ecf1;
    --hs-text: #2e3f50;
    --hs-muted: #7c98b6;
    --hs-link: #007a8c;
    --hs-primary: #ff7a59;
    --hs-primary-hover: #e86546;
    --hs-danger: #dc2626;
    --hs-danger-hover: #b91c1c;
    --hs-btn-bg: #eaf0f6;
    --radius: 4px;
    --font: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* =========================================================
   PAGE
   ========================================================= */
.hs-page {
    min-height: 100%;
    background: var(--hs-bg);
    padding: 16px 24px;
    box-sizing: border-box;
    font-family: var(--font);
    color: var(--hs-text);
}

/* =========================================================
   TITLE BAR
   ========================================================= */

.hs-titlebar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.hs-title h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.hs-count {
    font-size: 13px;
    color: var(--hs-muted);
    margin-top: 2px;
}

.hs-actions {
    display: flex;
    gap: 8px;
}

/* =========================================================
   GENERIC BUTTONS (PAGE LEVEL)
   ========================================================= */

.hs-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--hs-border);
    background: var(--hs-btn-bg);
    color: var(--hs-text);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

    .hs-btn:hover {
        background: #dde6ee;
    }

/* Primary action */
.hs-btn-primary {
    background: var(--hs-primary);
    border-color: var(--hs-primary);
    color: #fff;
}

    .hs-btn-primary:hover {
        background: var(--hs-primary-hover);
        border-color: var(--hs-primary-hover);
    }

/* Danger action */
.hs-btn-danger {
    background: var(--hs-danger);
    border-color: var(--hs-danger);
    color: #fff;
}

    .hs-btn-danger:hover {
        background: var(--hs-danger-hover);
        border-color: var(--hs-danger-hover);
    }

/* Ghost / secondary */
.hs-btn-ghost {
    background: transparent;
    border: 1px solid var(--hs-border);
}

/* =========================================================
   SEARCH
   ========================================================= */

.hs-searchbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--hs-surface);
    border: 1px solid var(--hs-border);
    border-radius: var(--radius);
    padding: 8px;
    margin: 12px 0;
    max-width:260px;
}

    .hs-searchbar input {
        border: none;
        outline: none;
        font-size: 13px;
        width: 260px;
        background: transparent;
    }

/* =========================================================
   FILTERS
   ========================================================= */

.hs-filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin: 10px 0 14px;
}

.hs-filter label {
    font-size: 12px;
    color: var(--hs-muted);
    margin-bottom: 4px;
    display: block;
}

.hs-filters select {
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius);
    border: 1px solid var(--hs-border);
    background: #fff;
    font-size: 13px;
}

/* =========================================================
   TABLE
   ========================================================= */

.hs-table-wrap {
    background: var(--hs-surface);
    border: 1px solid var(--hs-border);
}

.hs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .hs-table th {
        background: #f9fbfd;
        font-size: 11px;
        text-transform: uppercase;
        color: var(--hs-muted);
        font-weight: 600;
        padding: 10px;
        border-bottom: 1px solid var(--hs-border);
    }

    .hs-table td {
        padding: 10px;
        border-bottom: 1px solid var(--hs-border-soft);
    }

    .hs-table tr:hover {
        background: #f9fbfd;
    }

.hs-link {
    color: var(--hs-link);
    font-weight: 500;
    cursor: pointer;
}

/* =========================================================
   STATUS PILLS
   ========================================================= */

.hs-pill {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 999px;
    font-weight: 500;
}

.hs-pill-active {
    background: #dcfce7;
    color: #166534;
}

.hs-pill-inactive {
    background: #e5e7eb;
    color: #374151;
}

/* =========================================================
   BANNERS / FEEDBACK
   ========================================================= */

.hs-banner {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--hs-border);
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hs-banner-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.hs-banner-x {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
}

/* =========================================================
   MODALS
   ========================================================= */

.hs-modal-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =========================================================
   MODAL FOOTER BUTTONS (FIXED & WORKING)
   ========================================================= */

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--hs-border);
}

    .modal-footer button {
        height: 36px;
        padding: 0 16px;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
    }

    /* Modal primary */
    .modal-footer .btn-primary {
        background: var(--hs-primary);
        border: 1px solid var(--hs-primary);
        color: #fff;
    }

        .modal-footer .btn-primary:hover {
            background: var(--hs-primary-hover);
            border-color: var(--hs-primary-hover);
        }

    /* Modal secondary */
    .modal-footer .btn-secondary {
        background: #fff;
        border: 1px solid var(--hs-border);
        color: var(--hs-text);
    }

        .modal-footer .btn-secondary:hover {
            background: #f9fafb;
        }

    /* Modal danger */
    .modal-footer .btn-danger {
        background: var(--hs-danger);
        border: 1px solid var(--hs-danger);
        color: #fff;
    }

        .modal-footer .btn-danger:hover {
            background: var(--hs-danger-hover);
            border-color: var(--hs-danger-hover);
        }

    /* Disabled */
    .modal-footer button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

    /* Focus ring */
    .modal-footer button:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.35);
    }
    /* =========================================================
   MODAL – FORCE HS BUTTON STYLES (FIX INVISIBLE DELETE)
   ========================================================= */

    .modal-footer .hs-btn {
        background: var(--hs-btn-bg);
        border: 1px solid var(--hs-border);
        color: var(--hs-text);
    }

    .modal-footer .hs-btn-primary {
        background: var(--hs-primary);
        border-color: var(--hs-primary);
        color: #fff;
    }

        .modal-footer .hs-btn-primary:hover {
            background: var(--hs-primary-hover);
            border-color: var(--hs-primary-hover);
        }

    .modal-footer .hs-btn-danger {
        background: var(--hs-danger);
        border-color: var(--hs-danger);
        color: #fff;
    }

        .modal-footer .hs-btn-danger:hover {
            background: var(--hs-danger-hover);
            border-color: var(--hs-danger-hover);
        }

    .modal-footer .hs-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
/* =========================================================
   HUBSPOT – MANAGEMENT VIEW (FOR mgmt-page)
   ========================================================= */

.mgmt-page {
    background: var(--hs-bg);
    font-family: var(--font);
    color: var(--hs-text);
    padding: 20px 24px;
}

/* =========================================================
   HEADER
   ========================================================= */

.mgmt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

    .mgmt-header h1 {
        font-size: 20px;
        font-weight: 600;
        margin: 0;
    }

    .mgmt-header p {
        font-size: 13px;
        color: var(--hs-muted);
        margin: 4px 0 0;
    }

.mgmt-header-actions {
    display: flex;
    gap: 8px;
}

.mgmt-primary {
    height: 32px;
    padding: 0 12px;
    border-radius: 4px;
    border: none;
    background: var(--hs-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

    .mgmt-primary:hover {
        background: var(--hs-primary-hover);
    }

/* =========================================================
   VIEW SWITCH (Clients / Agents / Affiliates)
   ========================================================= */

.mgmt-views {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--hs-border);
    margin-bottom: 16px;
}

.mgmt-view {
    background: none;
    border: none;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--hs-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

    .mgmt-view.active {
        color: var(--hs-text);
        font-weight: 600;
        border-bottom-color: var(--hs-primary);
    }

/* =========================================================
   STATS BAR
   ========================================================= */

.mgmt-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

    .mgmt-stats .stat {
        background: var(--hs-surface);
        border: 1px solid var(--hs-border);
        border-radius: 6px;
        padding: 10px 14px;
        min-width: 140px;
    }

        .mgmt-stats .stat strong {
            font-size: 18px;
            font-weight: 600;
            display: block;
        }

        .mgmt-stats .stat span {
            font-size: 12px;
            color: var(--hs-muted);
        }

/* =========================================================
   CONTENT
   ========================================================= */

.mgmt-content {
    background: var(--hs-surface);
    border: 1px solid var(--hs-border);
    border-radius: 6px;
}

/* =========================================================
   GRID (LIST VIEW, NOT CARDS)
   ========================================================= */

.mgmt-grid {
    display: flex;
    flex-direction: column;
}

/* =========================================================
   ROW / CARD (HubSpot-style list row)
   ========================================================= */

.mgmt-card {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--hs-border-soft);
}

    .mgmt-card:last-child {
        border-bottom: none;
    }

    .mgmt-card:hover {
        background: #f9fbfd;
    }

    /* =========================================================
   AVATAR
   ========================================================= */

    .mgmt-card .avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #eaf0f6;
        color: var(--hs-text);
        font-size: 12px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* =========================================================
   INFO
   ========================================================= */

    .mgmt-card .info h3 {
        font-size: 13px;
        font-weight: 600;
        margin: 0;
    }

    .mgmt-card .info span {
        display: block;
        font-size: 12px;
        color: var(--hs-muted);
        line-height: 1.4;
    }

    /* =========================================================
   STATUS
   ========================================================= */

    .mgmt-card .status {
        font-size: 11px;
        padding: 3px 8px;
        border-radius: 999px;
        font-weight: 500;
    }

        .mgmt-card .status.on {
            background: #dcfce7;
            color: #166534;
        }

        .mgmt-card .status.off {
            background: #e5e7eb;
            color: #374151;
        }

    /* =========================================================
   ACTIONS
   ========================================================= */

    .mgmt-card .actions {
        display: flex;
        gap: 8px;
    }

        .mgmt-card .actions button {
            height: 28px;
            padding: 0 10px;
            font-size: 12px;
            border-radius: 4px;
            border: 1px solid var(--hs-border);
            background: #fff;
            cursor: pointer;
            color: var(--hs-text);
        }

            .mgmt-card .actions button:hover {
                background: #f9fafb;
            }

        .mgmt-card .actions .danger {
            color: var(--hs-danger);
            border-color: #fecaca;
        }

            .mgmt-card .actions .danger:hover {
                background: #fee2e2;
            }

/* =========================================================
   HS SURFACE (GENERIC CONTAINER)
   ========================================================= */

.hs-surface {
    background: var(--hs-surface);
    border: 1px solid var(--hs-border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.hs-surface-header {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    background: #f9fbfd;
    border-bottom: 1px solid var(--hs-border);
}

.hs-surface-body {
    padding: 12px;
}

/* =========================================================
   GRID
   ========================================================= */

.hs-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.hs-span-2 {
    grid-column: span 2;
}

/* =========================================================
   FIELD
   ========================================================= */

.hs-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .hs-field label {
        font-size: 12px;
        color: var(--hs-muted);
    }

    .hs-field input,
    .hs-field select {
        height: 34px;
        padding: 0 10px;
        font-size: 13px;
        border-radius: var(--radius);
        border: 1px solid var(--hs-border);
        background: #fff;
    }

        .hs-field input:focus,
        .hs-field select:focus {
            outline: none;
            border-color: var(--hs-primary);
            box-shadow: 0 0 0 2px rgba(255, 122, 89, 0.15);
        }

/* Helper text */
.hs-helper {
    font-size: 12px;
    color: var(--hs-muted);
}

/* Inline buttons */
.hs-inline {
    display: flex;
    gap: 6px;
}

/* Align bottom actions */
.hs-align-end {
    justify-content: flex-end;
}
/* =========================================================
   LAYOUT
   ========================================================= */

.hs-layout {
    display: flex;
    gap: 16px;
}

/* =========================================================
   PANELS
   ========================================================= */

.hs-panel {
    background: var(--hs-surface);
    border: 1px solid var(--hs-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}

.hs-panel-left {
    width: 280px;
    flex-shrink: 0;
}

.hs-panel-main {
    flex: 1;
}

/* =========================================================
   PANEL HEADER
   ========================================================= */

.hs-panel-header {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    background: #f9fbfd;
    border-bottom: 1px solid var(--hs-border);
}

.hs-panel-header-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* =========================================================
   PANEL BODY
   ========================================================= */

.hs-panel-body {
    padding: 12px;
}

/* =========================================================
   LIST (LEFT RAIL)
   ========================================================= */

.hs-list-item {
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
}

    .hs-list-item:hover {
        background: #f5f8fa;
    }

    .hs-list-item.active {
        background: #eaf0f6;
        border-left: 3px solid var(--hs-primary);
    }

.hs-list-title {
    font-size: 13px;
    font-weight: 500;
}

.hs-list-sub {
    font-size: 12px;
    color: var(--hs-muted);
}

/* =========================================================
   INPUTS
   ========================================================= */

.hs-input-readonly {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border-radius: var(--radius);
    border: 1px solid var(--hs-border);
    background: #f9fafb;
    color: var(--hs-text);
}

/* =========================================================
   EMPTY / MUTED
   ========================================================= */

.hs-muted {
    font-size: 13px;
    color: var(--hs-muted);
}

.hs-empty {
    padding: 24px;
    color: var(--hs-muted);
    font-size: 14px;
}

.hs-banner-error {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.hs-pill-warn {
    background: #fef3c7;
    color: #92400e;
}
.cg-body {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.cg-graph {
    flex: 1;
    background: var(--hs-surface);
    border: 1px solid var(--hs-border);
    border-radius: 6px;
    overflow: hidden;
}

.cg-svg {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 620px;
}

.cg-panel {
    width: 360px;
    flex-shrink: 0;
}

.cg-topbar {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.cg-kpi .cg-k {
    font-weight: 700;
    font-size: 16px;
}

.cg-kpi .cg-v {
    font-size: 12px;
    color: var(--hs-muted);
}

.cg-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cg-edge {
    fill: none;
    stroke: #cbd5e1;
    stroke-width: 2;
}

.cg-node {
    cursor: pointer;
}

.cg-node-bg {
    fill: #fff;
    stroke: var(--hs-border);
    filter: drop-shadow(0 8px 10px rgba(0,0,0,.06));
}

.cg-node-title {
    font-size: 13px;
    font-weight: 700;
    fill: var(--hs-text);
}

.cg-node-sub {
    font-size: 12px;
    fill: var(--hs-muted);
}

.cg-node-flag {
    font-size: 10px;
    font-weight: 800;
    fill: #b91c1c;
}

.cg-node.active .cg-node-bg {
    stroke: var(--hs-primary);
    stroke-width: 2.2;
}

.cg-node.blocked .cg-node-bg {
    stroke: #ef4444;
}
.hs-pill-warn {
    background: #fef3c7;
    color: #92400e;
}

.hs-banner-error {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}
