/* ==========================================================================
   Herv.ai Design System v2 — "Editorial Precision"
   Clean, confident, editorial. Data density + financial newspaper polish.

   This file merges the v2 prototype design system with production styles
   needed by existing Django templates. As templates are ported to v2,
   legacy sections can be removed.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,400&display=swap');


/* ==========================================================================
   CSS Custom Properties — v2 Design Tokens
   ========================================================================== */
:root {
    /* Surfaces */
    --h-bg: #FAFBFC;
    --h-surface: #FFFFFF;
    --h-border: #E8ECF0;
    --h-border-strong: #D1D9E0;

    /* Text */
    --h-text: #1A1D21;
    --h-text-secondary: #656D76;
    --h-text-tertiary: #8B949E;

    /* Primary */
    --h-primary: #0969DA;
    --h-primary-hover: #0550AE;
    --h-primary-subtle: #DDF4FF;
    --h-primary-glow: rgba(9, 105, 218, 0.12);

    /* Status */
    --h-success: #1A7F37;
    --h-success-subtle: #DAFBE1;
    --h-warning: #9A6700;
    --h-warning-subtle: #FFF8C5;
    --h-danger: #CF222E;
    --h-danger-subtle: #FFEBE9;
    --h-info: #0969DA;

    /* Navigation */
    --h-nav-bg: #FFFFFF;
    --h-nav-border: #D1D9E0;

    /* Typography */
    --h-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --h-space-xs: 4px;
    --h-space-sm: 8px;
    --h-space-md: 16px;
    --h-space-lg: 24px;
    --h-space-xl: 32px;
    --h-space-2xl: 48px;
    --h-space-3xl: 64px;

    /* Misc */
    --h-radius: 6px;
    --h-radius-lg: 8px;
    --h-transition: 150ms ease;
    --h-nav-height: 52px;
    --h-max-width: 1200px;

    /* Legacy aliases (used by existing templates — remove when fully ported) */
    --h-navy: #0D151E;
    --h-navy-light: #152231;
    --h-navy-lighter: #1A2B3D;
    --h-white: #FEFEFE;
    --h-card-bg: #FFFFFF;
    --h-card-border: #E8ECF0;
    --h-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --h-text-primary: #1A1D21;
    --h-text-muted: #8B949E;
    --h-sidebar-width: 240px;
    --h-navbar-height: 56px;
}


/* ==========================================================================
   Base Styles
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--h-font);
    font-size: 14px;
    color: var(--h-text);
    background: var(--h-bg);
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
button { font-family: var(--h-font); }


/* ==========================================================================
   v2 Top Navigation
   ========================================================================== */
.h-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--h-nav-height);
    background: var(--h-nav-bg);
    border-bottom: 1px solid var(--h-nav-border);
    display: flex;
    align-items: center;
    padding: 0 var(--h-space-lg);
}

.h-nav-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: var(--h-max-width);
    margin: 0 auto;
}

.h-nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: var(--h-space-xl);
    flex-shrink: 0;
    text-decoration: none;
}

.h-nav-brand img {
    width: 26px;
    height: 26px;
    border-radius: 6px;
}

.h-nav-brand-text {
    font-weight: 700;
    font-size: 16px;
    color: var(--h-text);
    letter-spacing: -0.02em;
}

.h-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.h-nav-link {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--h-text-secondary);
    border-radius: var(--h-radius);
    transition: color var(--h-transition), background var(--h-transition);
}

.h-nav-link:hover {
    color: var(--h-text);
    background: rgba(0, 0, 0, 0.04);
}

.h-nav-link.active {
    color: var(--h-text);
    font-weight: 700;
}

.h-nav-right {
    display: flex;
    align-items: center;
    gap: var(--h-space-md);
    margin-left: auto;
}

.h-nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--h-radius);
    cursor: pointer;
    transition: background var(--h-transition);
    position: relative;
}

.h-nav-user:hover {
    background: rgba(0, 0, 0, 0.04);
}

.h-nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--h-primary-subtle);
    color: var(--h-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.h-nav-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--h-text);
}

.h-nav-user-chevron {
    font-size: 10px;
    color: var(--h-text-tertiary);
}


/* ==========================================================================
   v2 Page Layout
   ========================================================================== */
.h-page {
    max-width: var(--h-max-width);
    margin: 0 auto;
    padding: var(--h-space-xl) var(--h-space-lg);
}

.h-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--h-space-xl);
    flex-wrap: wrap;
    gap: var(--h-space-md);
}

.h-page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--h-text);
    margin: 0;
    letter-spacing: -0.02em;
}

.h-page-actions {
    display: flex;
    align-items: center;
    gap: var(--h-space-sm);
}


/* ==========================================================================
   v2 Breadcrumb
   ========================================================================== */
.h-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--h-space-sm);
}

.h-breadcrumb:empty {
    display: none;
}

.h-breadcrumb a {
    font-size: 13px;
    font-weight: 500;
    color: var(--h-text-secondary);
    text-decoration: none;
    transition: color var(--h-transition);
}

.h-breadcrumb a:hover {
    color: var(--h-primary);
}

.h-breadcrumb-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--h-text-secondary);
    transition: color var(--h-transition);
}

.h-breadcrumb-back:hover {
    color: var(--h-primary);
}

.h-breadcrumb-sep {
    color: var(--h-text-tertiary);
    font-size: 12px;
}

.h-breadcrumb-current {
    font-size: 13px;
    font-weight: 500;
    color: var(--h-text);
}


/* ==========================================================================
   v2 Search Input
   ========================================================================== */
.h-search {
    position: relative;
    display: flex;
    align-items: center;
}

.h-search i {
    position: absolute;
    left: 10px;
    color: var(--h-text-tertiary);
    font-size: 13px;
    pointer-events: none;
}

.h-search input {
    padding: 7px 12px 7px 32px;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    font-family: var(--h-font);
    font-size: 13px;
    color: var(--h-text);
    background: var(--h-surface);
    width: 220px;
    transition: border-color var(--h-transition), box-shadow var(--h-transition);
}

.h-search input::placeholder {
    color: var(--h-text-tertiary);
}

.h-search input:focus {
    outline: none;
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px var(--h-primary-glow);
}


/* ==========================================================================
   v2 Buttons
   ========================================================================== */
.h-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--h-font);
    font-weight: 500;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: var(--h-radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--h-transition);
    white-space: nowrap;
    line-height: 1.5;
}

.h-btn:hover { text-decoration: none; }

.h-btn-primary {
    background: var(--h-primary);
    color: #fff;
    border-color: var(--h-primary);
}

.h-btn-primary:hover {
    background: var(--h-primary-hover);
    border-color: var(--h-primary-hover);
    color: #fff;
}

.h-btn-secondary {
    background: var(--h-surface);
    color: var(--h-text);
    border-color: var(--h-border-strong);
}

.h-btn-secondary:hover {
    background: var(--h-bg);
    border-color: var(--h-border-strong);
}

.h-btn-ghost {
    background: transparent;
    color: var(--h-text-secondary);
    border-color: transparent;
    padding: 6px 8px;
}

.h-btn-ghost:hover {
    color: var(--h-text);
    background: rgba(0, 0, 0, 0.04);
}

.h-btn-danger {
    background: transparent;
    color: var(--h-danger);
    border-color: transparent;
}

.h-btn-danger:hover {
    background: var(--h-danger-subtle);
}

.h-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.h-btn i {
    font-size: 12px;
}


/* ==========================================================================
   Filter Chips (for dashboard filtering)
   ========================================================================== */
.h-filter-chips {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.h-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--h-warning-subtle);
    color: var(--h-warning);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.h-filter-chip i {
    font-size: 12px;
}

.h-filter-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: inherit;
    opacity: 0.7;
    border-radius: 50%;
    transition: var(--h-transition);
}

.h-filter-remove:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}


/* ==========================================================================
   v2 Data Table
   ========================================================================== */
.h-table-container {
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius-lg);
    overflow: visible;
}

.h-table thead th:first-child { border-top-left-radius: var(--h-radius-lg); }
.h-table thead th:last-child { border-top-right-radius: var(--h-radius-lg); }
.h-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--h-radius-lg); }
.h-table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--h-radius-lg); }

.h-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.h-table thead th {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--h-text-tertiary);
    text-align: left;
    border-bottom: 1px solid var(--h-border);
    background: var(--h-bg);
    white-space: nowrap;
    user-select: none;
}

.h-table thead th.sortable {
    cursor: pointer;
}

.h-table thead th.sortable:hover {
    color: var(--h-text-secondary);
}

.h-table tbody td {
    padding: 10px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--h-border);
    vertical-align: middle;
}

.h-table td .form-check {
    margin: 0;
}

.h-table td .form-switch {
    padding-left: 2.5em;
}

.h-table tbody tr:last-child td {
    border-bottom: none;
}

.h-table tbody tr {
    transition: background var(--h-transition);
}

.h-table tbody tr:hover {
    background: #F6F8FA;
}

.h-th-right, .h-td-right {
    text-align: right;
}

.h-th-center, .h-td-center {
    text-align: center;
}

.h-td-muted {
    color: var(--h-text-secondary);
    font-size: 13px;
}

.h-table .h-client-name {
    font-weight: 500;
    color: var(--h-text);
    transition: color var(--h-transition);
}

.h-table .h-client-name:hover {
    color: var(--h-primary);
}

/* Row actions — hidden by default, shown on hover */
.h-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--h-transition);
}

.h-table tbody tr:hover .h-row-actions,
.h-row-actions:has(.show) {
    opacity: 1;
}

.h-table tbody tr:has(.show) {
    position: relative;
    z-index: 10;
}

.h-row-actions .dropdown-menu {
    background: var(--h-white, #fff);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1050;
}

.h-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--h-radius);
    color: var(--h-text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    transition: all var(--h-transition);
    position: relative;
}

.h-row-action:hover {
    color: var(--h-text);
    background: rgba(0, 0, 0, 0.06);
}

.h-row-action.danger:hover {
    color: var(--h-danger);
    background: var(--h-danger-subtle);
}

/* Row action tooltips — CSS-only */
.h-row-action::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    background: var(--h-text);
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease, visibility 0.12s ease;
}

.h-row-action:hover::after {
    opacity: 1;
    visibility: visible;
}

.h-row-action:not([data-tooltip])::after {
    display: none;
}

/* Table footer */
.h-table-footer {
    padding: 10px 16px;
    font-size: 12px;
    color: var(--h-text-tertiary);
    border-top: 1px solid var(--h-border);
}


/* ==========================================================================
   v2 Status Indicators
   ========================================================================== */
.h-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.h-status-dot.active { background: var(--h-success); }
.h-status-dot.paused { background: var(--h-text-tertiary); }
.h-status-dot.error { background: var(--h-danger); }
.h-status-dot.warning { background: var(--h-warning); }

.h-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.h-status.active { color: var(--h-success); }
.h-status.paused { color: var(--h-text-tertiary); }

.h-connected {
    color: var(--h-success);
    font-size: 14px;
}

.h-disconnected {
    color: var(--h-text-tertiary);
    font-size: 14px;
}


/* ==========================================================================
   v2 Issue Count (quality checks table)
   ========================================================================== */
.h-issue-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.h-issue-count.has-issues {
    color: var(--h-danger);
}

.h-issue-count.clean {
    color: var(--h-text-tertiary);
}

.h-issue-count.not-configured {
    color: var(--h-text-tertiary);
    font-weight: 400;
    font-style: italic;
}

.h-issue-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--h-danger);
    flex-shrink: 0;
}


/* ==========================================================================
   v2 Metadata Bar (Client Detail)
   ========================================================================== */
.h-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 14px 0;
    border-bottom: 1px solid var(--h-border);
    margin-bottom: var(--h-space-xl);
}

.h-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 20px;
    border-right: 1px solid var(--h-border);
    line-height: 1;
}

.h-meta-item:first-child {
    padding-left: 0;
}

.h-meta-item:last-child {
    border-right: none;
}

.h-meta-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--h-text-tertiary);
}

.h-meta-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--h-text);
}


/* ==========================================================================
   v2 Section Headers
   ========================================================================== */
.h-section {
    margin-bottom: var(--h-space-xl);
}

.h-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--h-space-md);
    flex-wrap: wrap;
    gap: var(--h-space-sm);
}

.h-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--h-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.h-section-actions {
    display: flex;
    align-items: center;
    gap: var(--h-space-sm);
}

/* Status badges (inline pill labels) */
.h-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    background: var(--h-bg-secondary, #f1f5f9);
    color: var(--h-text-secondary);
}
.h-status-badge.success { background: var(--h-success-subtle, #dcfce7); color: #166534; }
.h-status-badge.warning { background: var(--h-warning-subtle, #fef3c7); color: #92400e; }
.h-status-badge.danger { background: var(--h-danger-subtle, #fee2e2); color: #991b1b; }


/* ==========================================================================
   v2 Dropdown Menu
   ========================================================================== */
.h-dropdown {
    position: relative;
    display: inline-flex;
}

.h-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 4px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity var(--h-transition), transform var(--h-transition), visibility var(--h-transition);
}

.h-dropdown.open .h-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.h-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--h-text);
    border-radius: var(--h-radius);
    cursor: pointer;
    transition: background var(--h-transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--h-font);
}

.h-dropdown-item:hover {
    background: var(--h-bg);
}

.h-dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--h-text-secondary);
    font-size: 12px;
}

.h-dropdown-divider {
    height: 1px;
    background: var(--h-border);
    margin: 4px 0;
}

.h-dropdown-item.danger {
    color: var(--h-danger);
}

.h-dropdown-item.danger i {
    color: var(--h-danger);
}


/* ==========================================================================
   v2 Integration Row
   ========================================================================== */
.h-integration-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.h-integration-row + .h-integration-row {
    border-top: 1px solid var(--h-border);
}

.h-integration-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.h-integration-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--h-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.h-integration-status {
    font-size: 13px;
    color: var(--h-success);
    margin-left: 4px;
}

.h-integration-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.h-integration-icon-fa {
    width: 24px;
    text-align: center;
    font-size: 18px;
    color: var(--h-text-secondary);
}


/* ==========================================================================
   v2 Warning Inline (destructive checks)
   ========================================================================== */
.h-warning-inline {
    color: var(--h-warning);
    font-size: 12px;
    margin-left: 4px;
}


/* ==========================================================================
   v2 Toggle Switch
   ========================================================================== */
.h-toggle {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.h-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.h-toggle-track {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #D1D9E0;
    border-radius: 20px;
    transition: background var(--h-transition);
}

.h-toggle-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--h-transition);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.h-toggle input:checked + .h-toggle-track {
    background: var(--h-primary);
}

.h-toggle input:checked + .h-toggle-track::after {
    transform: translateX(14px);
}

.h-toggle input:disabled + .h-toggle-track {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Legacy toggle using label (existing templates) */
.h-toggle label {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #D1D9E0;
    border-radius: 20px;
    transition: all var(--h-transition);
    margin: 0;
}

.h-toggle label::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: transform var(--h-transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.h-toggle input:checked + label { background: var(--h-primary); }
.h-toggle input:checked + label::after { transform: translateX(14px); }
.h-toggle input:disabled + label { opacity: 0.4; cursor: not-allowed; }

/* BS5 form-switch override */
.form-switch .form-check-input:checked {
    background-color: var(--h-primary);
    border-color: var(--h-primary);
}

/* Drag-and-drop reorder */
.h-sortable-ghost {
    opacity: 0.4;
    background: var(--h-primary-subtle, #e0f2fe);
}
.drag-handle:active {
    cursor: grabbing;
}

/* Fix toggle margin bleed in table cells */
.h-table .form-check {
    margin: 0;
    padding: 0;
    min-height: auto;
}
.h-table .form-switch {
    padding-left: 2.5em;
}


/* ==========================================================================
   v2 Popover Component
   ========================================================================== */
.h-popover-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: var(--h-text-tertiary);
    cursor: pointer;
    font-size: 13px;
    margin-left: 4px;
    transition: color var(--h-transition);
    position: relative;
    vertical-align: middle;
    border: none;
    background: none;
    padding: 0;
}

.h-popover-trigger:hover,
.h-popover-trigger:focus {
    color: var(--h-primary);
    outline: none;
}

.h-popover-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.h-popover {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: var(--h-space-md);
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

.h-popover.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.h-popover-arrow {
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: var(--h-surface);
    border-left: 1px solid var(--h-border);
    border-bottom: 1px solid var(--h-border);
}

.h-popover-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--h-text);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.h-popover-body {
    font-size: 13px;
    color: var(--h-text-secondary);
    line-height: 1.5;
    margin: 0 0 10px 0;
}

.h-popover-warning {
    font-size: 12px;
    color: var(--h-warning);
    font-weight: 500;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.h-popover-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--h-primary);
    transition: color var(--h-transition);
}

.h-popover-link:hover {
    color: var(--h-primary-hover);
}


/* ==========================================================================
   v2 Loading / Spinner
   ========================================================================== */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.h-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.h-spinner.dark {
    border-color: rgba(0, 0, 0, 0.12);
    border-top-color: var(--h-text-secondary);
}

.h-btn.loading {
    pointer-events: none;
    opacity: 0.85;
}


/* ==========================================================================
   v2 Issue Summary (Clients List — clickable issue counts)
   ========================================================================== */
.h-issue-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--h-text-tertiary);
    cursor: pointer;
    padding: 2px 8px;
    border-radius: var(--h-radius);
    transition: background var(--h-transition);
    text-decoration: none;
}

.h-issue-summary:hover {
    background: rgba(0, 0, 0, 0.04);
}

.h-issue-summary.has-issues {
    color: var(--h-danger);
}

.h-issue-summary.critical {
    color: var(--h-danger);
    font-weight: 700;
}

.h-issue-summary .h-issue-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--h-danger);
    flex-shrink: 0;
}


/* ==========================================================================
   v2 Assignee Cell
   ========================================================================== */
.h-assignee {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.h-assignee-name {
    font-size: 13px;
    color: var(--h-text-secondary);
    font-weight: 500;
}

.h-assignee-role {
    font-size: 11px;
    color: var(--h-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}


/* ==========================================================================
   v2 Connection Dot (inline with client name)
   ========================================================================== */
.h-status-icon {
    font-size: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

.h-status-icon.connected {
    color: var(--h-success);
}

.h-status-icon.warning {
    color: var(--h-warning, #f59e0b);
}

.h-status-icon.paused {
    color: var(--h-text-tertiary);
    opacity: 0.6;
}


/* ==========================================================================
   v2 Edit Pencil Icon (metadata bar)
   ========================================================================== */
.h-meta-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    color: var(--h-text-tertiary);
    font-size: 10px;
    cursor: pointer;
    margin-left: 4px;
    transition: color var(--h-transition), background var(--h-transition);
    text-decoration: none;
}

.h-meta-edit:hover {
    color: var(--h-primary);
    background: var(--h-primary-subtle);
}

/* v2 Meta Action Links (connect, reconnect, switch) */
.h-meta-action {
    font-size: 13px;
    font-weight: 500;
    color: var(--h-primary);
    text-decoration: none;
    transition: color var(--h-transition);
}
.h-meta-action:hover {
    color: var(--h-primary-hover);
    text-decoration: underline;
}
.h-meta-action--subtle {
    color: var(--h-text-tertiary);
}
.h-meta-action--subtle:hover {
    color: var(--h-primary);
}
.h-meta-sep {
    color: var(--h-text-tertiary);
    margin: 0 4px;
    font-size: 13px;
}


/* ==========================================================================
   v2 Check Name
   ========================================================================== */
.h-check-name {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 500;
}

.h-check-name.unconfigured {
    color: var(--h-text-tertiary);
}

.h-setup-hint {
    font-size: 12px;
    color: var(--h-text-tertiary);
    font-weight: 400;
    font-style: italic;
    margin-top: 2px;
}


/* ==========================================================================
   v2 Staggered Fade-in Animation
   ========================================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.h-table tbody tr {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

.h-table tbody tr:nth-child(1) { animation-delay: 0.02s; }
.h-table tbody tr:nth-child(2) { animation-delay: 0.04s; }
.h-table tbody tr:nth-child(3) { animation-delay: 0.06s; }
.h-table tbody tr:nth-child(4) { animation-delay: 0.08s; }
.h-table tbody tr:nth-child(5) { animation-delay: 0.10s; }
.h-table tbody tr:nth-child(6) { animation-delay: 0.12s; }
.h-table tbody tr:nth-child(7) { animation-delay: 0.14s; }
.h-table tbody tr:nth-child(8) { animation-delay: 0.16s; }
.h-table tbody tr:nth-child(9) { animation-delay: 0.18s; }
.h-table tbody tr:nth-child(10) { animation-delay: 0.20s; }
.h-table tbody tr:nth-child(11) { animation-delay: 0.22s; }
.h-table tbody tr:nth-child(12) { animation-delay: 0.24s; }


/* ==========================================================================
   v2 Settings Page
   ========================================================================== */
.h-settings-layout {
    display: flex;
    gap: var(--h-space-xl);
    align-items: flex-start;
}

.h-settings-nav {
    position: sticky;
    top: calc(var(--h-nav-height) + var(--h-space-lg));
    flex-shrink: 0;
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: var(--h-space-lg);
    border-right: 1px solid var(--h-border);
}

.h-settings-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--h-text-secondary);
    border-radius: var(--h-radius);
    transition: color var(--h-transition), background var(--h-transition);
}

.h-settings-nav-item:hover {
    color: var(--h-text);
    background: rgba(0, 0, 0, 0.04);
}

.h-settings-nav-item.active {
    color: var(--h-text);
    font-weight: 700;
    background: var(--h-primary-subtle);
}

.h-settings-nav-item i { width: 16px; text-align: center; font-size: 13px; }

.h-settings-content { flex: 1; min-width: 0; }

.h-settings-section { margin-bottom: var(--h-space-2xl); }

.h-settings-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--h-space-md);
}

.h-settings-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--h-text);
    margin: 0;
}

.h-settings-card {
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius-lg);
    padding: var(--h-space-lg);
}

.h-settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--h-space-lg);
    margin-bottom: var(--h-space-md);
}
.h-settings-row:last-child { margin-bottom: 0; }

.h-settings-field { display: flex; flex-direction: column; gap: 4px; }

.h-settings-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--h-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.h-settings-value { font-size: 14px; color: var(--h-text); }

/* Integration cards */
.h-integration-card {
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius-lg);
    padding: var(--h-space-md) var(--h-space-lg);
    margin-bottom: var(--h-space-sm);
}

.h-integration-header {
    display: flex;
    align-items: center;
    gap: var(--h-space-md);
}

.h-integration-logo {
    flex-shrink: 0;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.h-integration-logo img { max-height: 28px; max-width: 40px; }

.h-integration-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.h-integration-name { font-size: 14px; font-weight: 600; color: var(--h-text); }
.h-integration-status { font-size: 13px; }
.h-integration-status.connected { color: var(--h-success); }
.h-integration-status.disconnected { color: var(--h-text-tertiary); }
.h-integration-actions { display: flex; gap: var(--h-space-sm); }

/* Role badge */
.h-role-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--h-primary-subtle);
    color: var(--h-primary);
}
.h-role-badge.admin { background: var(--h-warning-subtle); color: var(--h-warning); }

/* Inline select */
.h-select-inline {
    font-family: var(--h-font);
    font-size: 13px;
    color: var(--h-text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--h-radius);
    padding: 2px 6px;
    cursor: pointer;
    transition: border-color var(--h-transition);
}
.h-select-inline:hover,
.h-select-inline:focus { border-color: var(--h-border-strong); outline: none; }


/* ==========================================================================
   LEGACY: Sidebar Layout (still used by existing templates until Task #6)
   ========================================================================== */
.h-app {
    display: flex;
    min-height: 100vh;
}

.h-main {
    flex: 1;
    margin-left: var(--h-sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left var(--h-transition);
}

.h-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--h-sidebar-width);
    background: var(--h-navy);
    z-index: 1030;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--h-transition);
}

.h-sidebar.collapsed {
    transform: translateX(calc(-1 * var(--h-sidebar-width)));
}

.h-sidebar.collapsed ~ .h-main {
    margin-left: 0;
}

.h-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.h-sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.h-sidebar-brand-text {
    font-weight: 700;
    font-size: 18px;
    color: var(--h-white);
    letter-spacing: -0.01em;
}

.h-sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.h-nav-group-label {
    padding: 20px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.35);
}

.h-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--h-transition);
}

.h-nav-item:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}

.h-nav-item.active {
    color: var(--h-white);
    background: rgba(9, 105, 218, 0.08);
    border-left-color: var(--h-primary);
}

.h-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}


/* ==========================================================================
   LEGACY: Navbar (sidebar layout)
   ========================================================================== */
.h-navbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--h-navbar-height);
    background: var(--h-navy);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.h-navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.h-sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.h-sidebar-toggle:hover { color: var(--h-white); }

.h-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.h-breadcrumbs a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}
.h-breadcrumbs a:hover { color: var(--h-white); }

.h-navbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.h-navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.h-user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background var(--h-transition);
    text-decoration: none;
}
.h-user-menu:hover { background: rgba(255, 255, 255, 0.06); }

.h-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.h-user-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
}

.h-user-chevron {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
}

/* Subscription warning badges in top nav */
.h-sub-warning {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    white-space: nowrap;
}

.h-sub-warning-danger {
    background: var(--h-danger-subtle);
    color: var(--h-danger);
}

.h-sub-warning-danger a {
    color: var(--h-danger);
    text-decoration: underline;
    margin-left: 4px;
    font-weight: 700;
}

.h-sub-warning-danger a:hover {
    color: var(--h-primary-hover);
}

.h-sub-warning-warning {
    background: var(--h-warning-subtle);
    color: var(--h-warning);
}


/* ==========================================================================
   LEGACY: Content Area
   ========================================================================== */
.h-content {
    flex: 1;
    padding: var(--h-space-lg);
}


/* ==========================================================================
   LEGACY: Cards
   ========================================================================== */
.h-card {
    background: var(--h-card-bg);
    border: 1px solid var(--h-card-border);
    border-radius: var(--h-radius-lg);
    box-shadow: var(--h-card-shadow);
    margin-bottom: var(--h-space-lg);
}

.h-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--h-card-border);
    flex-wrap: wrap;
    gap: 12px;
}

.h-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--h-text);
    margin: 0;
}

.h-card-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.h-card-body { padding: 20px; }
.h-card-body-table { padding: 0; }
.h-card-body-flush { padding: 0; }


/* ==========================================================================
   LEGACY: Detail Grid
   ========================================================================== */
.h-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 576px) {
    .h-detail-grid { grid-template-columns: 1fr; }
}

.h-detail-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--h-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.h-detail-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--h-text);
}


/* ==========================================================================
   LEGACY: Badges
   ========================================================================== */
.h-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
}

.h-badge-success { background: var(--h-success-subtle); color: #166534; }
.h-badge-warning { background: var(--h-warning-subtle); color: #92400E; }
.h-badge-danger { background: var(--h-danger-subtle); color: #991B1B; }
.h-badge-info { background: var(--h-primary-subtle); color: #1E40AF; }
.h-badge-muted { background: #F1F5F9; color: #64748B; }

.h-status-success { color: var(--h-success); }
.h-status-danger { color: var(--h-danger); }
.h-status-warning { color: var(--h-warning); }


/* ==========================================================================
   LEGACY: Section Nav (Sticky Tabs)
   ========================================================================== */
.h-section-nav {
    position: sticky;
    top: var(--h-navbar-height);
    z-index: 50;
    background: var(--h-bg);
    display: flex;
    gap: 4px;
    padding: 8px 0 16px;
    margin-bottom: var(--h-space-md);
    border-bottom: 1px solid var(--h-card-border);
}

.h-section-nav-item {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--h-text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all var(--h-transition);
}

.h-section-nav-item:hover {
    color: var(--h-text);
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

.h-section-nav-item.active {
    color: var(--h-primary);
    background: var(--h-primary-subtle);
}


/* ==========================================================================
   LEGACY: Grid Layouts
   ========================================================================== */
.h-grid { display: grid; gap: var(--h-space-lg); margin-bottom: var(--h-space-lg); }
.h-grid-2 { grid-template-columns: 1fr 1fr; }
.h-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 768px) {
    .h-grid-2, .h-grid-3 { grid-template-columns: 1fr; }
}


/* ==========================================================================
   LEGACY: Button Variants (existing templates)
   ========================================================================== */
.h-btn-outline {
    background: transparent;
    color: var(--h-text-secondary);
    border-color: var(--h-border-strong);
}
.h-btn-outline:hover {
    color: var(--h-text);
    border-color: var(--h-border-strong);
    background: var(--h-bg);
}

.h-btn-success { background: var(--h-success); color: white; border-color: var(--h-success); }
.h-btn-warning { background: var(--h-warning); color: white; border-color: var(--h-warning); }

.h-btn-danger-outline { background: transparent; color: var(--h-danger); border-color: var(--h-danger); }
.h-btn-danger-outline:hover { background: var(--h-danger-subtle); color: var(--h-danger); }

.h-btn-xs { padding: 4px 10px; font-size: 11px; }
.h-btn-lg { padding: 10px 20px; font-size: 14px; }
.h-btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.h-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--h-text-secondary);
    text-decoration: none;
    transition: all var(--h-transition);
    background: none;
    border: none;
    cursor: pointer;
}
.h-icon-btn:hover { color: var(--h-primary); background: var(--h-primary-subtle); }

.h-icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    color: var(--h-text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all var(--h-transition);
}
.h-icon-action:hover { color: var(--h-primary); background: var(--h-primary-subtle); }
.h-icon-action.h-icon-danger:hover { color: var(--h-danger); background: var(--h-danger-subtle); }


/* ==========================================================================
   LEGACY: Search Input
   ========================================================================== */
.h-search-input {
    position: relative;
    display: flex;
    align-items: center;
}

.h-search-input > i {
    position: absolute;
    left: 10px;
    color: var(--h-text-tertiary);
    font-size: 13px;
    pointer-events: none;
}

.h-search-input input {
    padding: 7px 12px 7px 32px;
    border: 1px solid var(--h-border);
    border-radius: 6px;
    font-family: var(--h-font);
    font-size: 13px;
    color: var(--h-text);
    background: var(--h-surface);
    width: 180px;
    transition: all var(--h-transition);
}

.h-search-input input::placeholder { color: var(--h-text-tertiary); }

.h-search-input input:focus {
    outline: none;
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px var(--h-primary-glow);
    width: 220px;
}


/* ==========================================================================
   LEGACY: Forms
   ========================================================================== */
.h-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--h-text);
    margin-bottom: 6px;
}

.h-form-control {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--h-font);
    font-size: 14px;
    color: var(--h-text);
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    transition: all var(--h-transition);
}

.h-form-control:focus {
    outline: none;
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px var(--h-primary-glow);
}

.h-form-control::placeholder { color: var(--h-text-tertiary); }

.h-form-help {
    font-size: 12px;
    color: var(--h-text-tertiary);
    margin-top: 4px;
}

/* BS5 form-control focus override */
.form-control:focus {
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px var(--h-primary-glow);
}

.form-select:focus {
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px var(--h-primary-glow);
}

/* Validation */
.is-invalid .form-control,
.is-invalid .form-select,
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--h-danger);
}

.invalid-feedback { color: var(--h-danger); font-size: 13px; }

/* Select2 theme override */
.select2-container--bootstrap-5 .select2-selection {
    border-color: var(--h-border);
    border-radius: var(--h-radius);
    font-family: var(--h-font);
}

.select2-container--bootstrap-5 .select2-selection--single:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px var(--h-primary-glow);
}

.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
    background-color: var(--h-primary);
}


/* ==========================================================================
   LEGACY: Select
   ========================================================================== */
.h-select {
    font-family: var(--h-font);
    font-size: 14px;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--h-border);
    border-radius: 6px;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B949E' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none;
    appearance: none;
    color: var(--h-text);
    cursor: pointer;
    transition: border-color var(--h-transition);
    width: 100%;
}
.h-select:focus { outline: none; border-color: var(--h-primary); box-shadow: 0 0 0 3px var(--h-primary-glow); }
.h-select-sm { padding: 6px 28px 6px 10px; font-size: 13px; }


/* ==========================================================================
   LEGACY: Modals (BS5 override)
   ========================================================================== */
.modal-content {
    border: none;
    border-radius: var(--h-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom-color: var(--h-border);
    padding: 20px 24px;
}

.modal-title {
    font-family: var(--h-font);
    font-size: 16px;
    font-weight: 600;
}

.modal-body { padding: 24px; }

.modal-footer {
    border-top-color: var(--h-border);
    padding: 16px 24px;
}

.modal-backdrop.show { opacity: 0.5; }

.modal.show .modal-dialog { animation: modalSlideIn 0.2s ease-out; }

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ==========================================================================
   LEGACY: Alerts
   ========================================================================== */
.h-alert {
    padding: 14px 18px;
    border-radius: var(--h-radius);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: var(--h-space-md);
}

.h-alert-danger { background: var(--h-danger-subtle); color: #991B1B; border: 1px solid #FECACA; }
.h-alert-warning { background: var(--h-warning-subtle); color: #92400E; border: 1px solid #FDE68A; }
.h-alert-success { background: var(--h-success-subtle); color: #166534; border: 1px solid #BBF7D0; }
.h-alert-info { background: var(--h-primary-subtle); color: #1E40AF; border: 1px solid #BFDBFE; }

.alert { border-radius: var(--h-radius); font-family: var(--h-font); }


/* ==========================================================================
   LEGACY: Misc / Helpers
   ========================================================================== */
.h-info-icon { color: var(--h-text-tertiary); font-size: 13px; cursor: help; }
.h-warning-icon { color: var(--h-warning); font-size: 13px; }
.h-row-warning { background: var(--h-warning-subtle); }
.h-row-warning:hover { background: #FEF3C7 !important; }

.h-link { color: var(--h-primary); text-decoration: none; font-weight: 500; }
.h-link:hover { color: var(--h-primary-hover); text-decoration: underline; }

.cursor-pointer { cursor: pointer; }

@media (max-width: 576px) {
    .h-hide-mobile { display: none !important; }
}


/* ==========================================================================
   LEGACY: BS4 -> BS5 Compatibility Helpers (remove after full migration)
   ========================================================================== */
.form-group { margin-bottom: 1rem; }

.btn-default {
    background-color: white;
    border-color: var(--h-border);
    color: var(--h-text-secondary);
}
.btn-default:hover {
    background-color: var(--h-bg);
    border-color: var(--h-border-strong);
    color: var(--h-text);
}

.font-weight-bold { font-weight: 700 !important; }
.font-weight-light { font-weight: 300 !important; }

/* Override AdminLTE/BS card styles */
.card {
    border-radius: var(--h-radius-lg);
    border-color: var(--h-border);
    box-shadow: var(--h-card-shadow);
}

.card-header {
    background: transparent;
    border-bottom-color: var(--h-border);
    padding: 16px 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.card-body { padding: 20px; }

/* BS5 button brand overrides */
.btn-primary {
    background-color: var(--h-primary);
    border-color: var(--h-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--h-primary-hover);
    border-color: var(--h-primary-hover);
    box-shadow: 0 2px 8px var(--h-primary-glow);
}

.btn-info { background-color: var(--h-info); border-color: var(--h-info); }
.btn-danger { background-color: var(--h-danger); border-color: var(--h-danger); }
.btn-warning { background-color: var(--h-warning); border-color: var(--h-warning); color: white; }
.btn { font-family: var(--h-font); font-weight: 600; }


/* ==========================================================================
   LEGACY: Responsive Sidebar
   ========================================================================== */
@media (max-width: 991.98px) {
    .h-sidebar {
        transform: translateX(calc(-1 * var(--h-sidebar-width)));
    }

    .h-sidebar.show {
        transform: translateX(0);
    }

    .h-main {
        margin-left: 0;
    }
}

.h-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1029;
}

@media (max-width: 991.98px) {
    .h-sidebar.show ~ .h-sidebar-overlay {
        display: block;
    }
}


/* ==========================================================================
   v2 Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .h-nav {
        padding: 0 var(--h-space-md);
    }

    .h-page {
        padding: var(--h-space-lg) var(--h-space-md);
    }

    .h-meta-bar {
        flex-direction: column;
        gap: var(--h-space-sm);
    }

    .h-meta-item {
        border-right: none;
        padding: 4px 0;
    }

    .h-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .h-table-container {
        overflow-x: auto;
    }

    .h-row-actions {
        opacity: 1;
    }
}


/* ==========================================================================
   Template Builder — Quality Check Table
   ========================================================================== */
/* Detail row — animated expand/collapse via max-height */
.qc-detail-row {
    display: table-row;
}

.qc-detail-row > td {
    padding: 0 !important;
    border-bottom: none !important;
    overflow: hidden;
}

.qc-detail-row .qc-detail-wrapper {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 300ms ease, opacity 200ms ease 50ms;
}

.qc-detail-row.expanded .qc-detail-wrapper {
    max-height: 1200px;
    opacity: 1;
    overflow: visible;
    transition: max-height 300ms ease, opacity 200ms ease;
}

/* Suppress hover on detail rows */
.h-table tbody tr.qc-detail-row:hover {
    background: transparent;
}

/* Inset panel container */
.qc-detail-panel {
    margin: 0 16px 12px;
    padding: 20px 24px;
    background: var(--h-surface);
    border-left: 3px solid var(--h-primary);
    border-radius: var(--h-radius);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Micro-header for field groups */
.qc-detail-group-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748B; /* 4.6:1 contrast on white — WCAG AA */
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 0 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--h-border);
}

/* Field group spacing */
.qc-detail-group {
    margin-bottom: 16px;
}

.qc-detail-group:last-child {
    margin-bottom: 0;
}

/* CSS Grid layout for field pairs */
.qc-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.qc-detail-grid--full {
    grid-column: 1 / -1;
}

/* Help text under form fields */
.qc-help-text {
    font-size: 12px;
    color: var(--h-text-tertiary);
    margin-top: 4px;
    line-height: 1.4;
}

/* Form field styling inside detail panel */
.qc-detail-panel .form-group {
    margin-bottom: 0;
}

.qc-detail-panel label,
.qc-detail-panel .form-check-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--h-text-secondary);
    margin-bottom: 6px;
    display: block;
}

.qc-detail-panel .form-control,
.qc-detail-panel .form-select,
.qc-detail-panel select {
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    color: var(--h-text);
    background: var(--h-surface);
    transition: border-color var(--h-transition), box-shadow var(--h-transition);
}

.qc-detail-panel .form-control:focus,
.qc-detail-panel .form-select:focus,
.qc-detail-panel select:focus {
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px rgba(19, 167, 255, 0.12);
    outline: none;
}

/* Switch toggle inside detail panel */
.qc-detail-panel .form-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 0;
    min-height: auto;
}

.qc-detail-panel .form-switch .form-check-input {
    margin: 0;
    float: none;
    flex-shrink: 0;
    width: 2em;
    position: relative;
}

.qc-detail-panel .form-switch .form-check-label {
    margin-bottom: 0;
    padding-left: 0;
    display: inline;
}

/* Hide the Check Options group when it has no visible fields */
.qc-detail-group--options:has(.qc-detail-grid:not(:has(.form-group))) {
    display: none;
}

@media (max-width: 768px) {
    .qc-detail-grid {
        grid-template-columns: 1fr;
    }

    .qc-detail-panel {
        margin: 0 8px 8px;
        padding: 16px;
    }
}

/* ==========================================================================
   Crontab Widget — v2 Redesign
   ========================================================================== */

/* Toggle row: form-switch below the schedule trigger */
.h-crontab-toggle {
    margin-top: 6px;
}

.h-crontab-toggle .form-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 0;
    min-height: auto;
}

.h-crontab-toggle .form-check-input {
    margin: 0;
    float: none;
    flex-shrink: 0;
    width: 2em;
    position: relative;
}

.h-crontab-toggle .form-check-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--h-text-secondary);
    margin-bottom: 0;
    padding-left: 0;
    display: inline;
}

/* Schedule trigger button — looks like a styled read-only field */
.h-crontab-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    font-family: var(--h-font);
    color: var(--h-text);
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--h-transition), box-shadow var(--h-transition), background var(--h-transition);
}

.h-crontab-trigger:hover:not(:disabled) {
    border-color: var(--h-primary);
    background: #F8FAFC;
}

.h-crontab-trigger:focus:not(:disabled) {
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px rgba(19, 167, 255, 0.12);
    outline: none;
}

.h-crontab-trigger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--h-bg);
}

.h-crontab-trigger__icon {
    color: var(--h-text-tertiary);
    font-size: 14px;
    flex-shrink: 0;
}

.h-crontab-trigger .crontab-display {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.h-crontab-trigger__edit {
    color: var(--h-primary);
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
    transition: text-decoration var(--h-transition);
}

.h-crontab-trigger:hover:not(:disabled) .h-crontab-trigger__edit,
.h-crontab-trigger:focus:not(:disabled) .h-crontab-trigger__edit {
    text-decoration: underline;
}

/* Active/pressed state for click feedback */
.h-crontab-trigger:active:not(:disabled) {
    background: #e0f2fe;
    transform: scale(0.995);
}

/* Placeholder state */
.h-crontab-trigger:disabled .crontab-display:empty::before,
.h-crontab-trigger .crontab-display:empty::before {
    content: "Click to set schedule";
    color: var(--h-text-tertiary);
}

/* ==========================================================================
   Date Range Select — v2 Styling
   ========================================================================== */

/* Apply form-select appearance to the date range widget */
.quality_check_date_range {
    display: block;
    width: 100%;
    font-size: 14px;
    font-family: var(--h-font);
    padding: 8px 36px 8px 12px;
    color: var(--h-text);
    background-color: var(--h-surface);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px 10px;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color var(--h-transition), box-shadow var(--h-transition);
    cursor: pointer;
}

.quality_check_date_range:hover {
    border-color: var(--h-primary);
}

.quality_check_date_range:focus {
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px rgba(19, 167, 255, 0.12);
    outline: none;
}

.quality_check_date_range:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--h-bg);
}

/* Vertically center the enable toggle in each row */
.qc-main-row .form-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 0;
    min-height: auto;
    margin: 0;
}

.qc-main-row .form-switch .form-check-input {
    margin: 0;
    float: none;
}

.qc-expand-btn {
    background: none;
    border: none;
    color: var(--h-text-tertiary);
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--h-radius);
}

.qc-expand-btn:hover {
    color: var(--h-text);
    background: var(--h-bg);
}

.qc-expand-btn.expanded {
    transform: rotate(180deg);
}

.tb-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tb-search {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.tb-search input {
    width: 100%;
    padding: 6px 12px 6px 32px;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    font-size: 13px;
    background: var(--h-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 10px center;
    transition: border-color var(--h-transition);
}

.tb-search input:focus {
    outline: none;
    border-color: var(--h-primary);
}

.tb-bulk-actions {
    display: flex;
    gap: 8px;
}

.tb-badge-destructive {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--h-warning, #D97706);
    background: rgba(217, 119, 6, 0.08);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.tb-badge-xero-na {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--h-text-tertiary);
    background: var(--h-bg);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.tb-schedule-summary {
    font-size: 13px;
    color: var(--h-text-secondary);
}

.h-sortable-ghost {
    opacity: 0.4;
    background: var(--h-bg);
}

.tb-meta-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 0;
}

.tb-meta-grid__fields {
    padding-right: var(--h-space-lg);
}

.tb-meta-grid__options {
    padding-left: var(--h-space-lg);
    border-left: 1px solid var(--h-border);
}

.tb-meta-grid__options-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--h-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--h-space-md);
}

@media (max-width: 768px) {
    .tb-meta-grid {
        grid-template-columns: 1fr;
    }
    .tb-meta-grid__fields {
        padding-right: 0;
    }
    .tb-meta-grid__options {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--h-border);
        padding-top: var(--h-space-md);
        margin-top: var(--h-space-md);
    }
    .tb-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .tb-search {
        max-width: none;
    }
}


/* ─── Unsaved Changes Badge ─── */
.tb-unsaved-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--h-warning-text, #9a6700);
    background: var(--h-warning-subtle, #fff8c5);
    border: 1px solid var(--h-warning-border, #d4a72c);
    border-radius: var(--h-radius);
    padding: 4px 10px;
    animation: tb-badge-appear 0.25s ease-out;
}

@keyframes tb-badge-appear {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ─── Chip / Toggle Selector ─── */
.h-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.h-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1.5px solid var(--h-border);
    border-radius: 20px;
    background: #fff;
    color: var(--h-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.h-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.h-chip-check {
    width: 14px;
    height: 14px;
    display: none;
}

.h-chip:has(input:checked) {
    background: var(--h-primary-subtle, #e8f4fd);
    border-color: var(--h-primary);
    color: var(--h-primary);
}

.h-chip:has(input:checked) .h-chip-check {
    display: block;
}

.h-chip:hover:not(.h-chip--disabled) {
    border-color: var(--h-primary);
}

.h-chip:focus-within:not(.h-chip--disabled) {
    outline: 2px solid var(--h-primary);
    outline-offset: 2px;
}

.h-chip--disabled {
    opacity: 0.55;
    cursor: not-allowed;
}


/* ─── Token Multi-Select ─── */

.h-token-field {
    position: relative;
}

.h-token-label {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.h-token-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--h-text-tertiary);
}

.h-token-container {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 5px;
    min-height: 38px;
    max-height: 120px;
    overflow-y: auto;
    padding: 5px 8px;
    border: 1.5px solid var(--h-border);
    border-radius: 6px;
    background: #fff;
    cursor: text;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.h-token-container:focus-within {
    border-color: var(--h-primary);
    box-shadow: 0 0 0 3px var(--h-primary-glow);
}

.h-token-container.h-token--disabled {
    background: var(--h-bg-alt, #f6f8fa);
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

/* Scrollbar refinement */
.h-token-container::-webkit-scrollbar { width: 4px; }
.h-token-container::-webkit-scrollbar-track { background: transparent; }
.h-token-container::-webkit-scrollbar-thumb {
    background: var(--h-border-strong);
    border-radius: 2px;
}

/* Individual pill */
.h-token-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    padding: 0 8px;
    background: var(--h-primary-subtle);
    border: 1px solid rgba(9, 105, 218, 0.18);
    border-radius: 13px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--h-primary);
    white-space: nowrap;
    animation: h-token-in 0.12s ease-out;
}

@keyframes h-token-in {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

.h-token-pill--admin {
    background: var(--h-bg-alt, #f6f8fa);
    border-color: var(--h-border);
    color: var(--h-text-secondary);
}

.h-token-pill__role {
    font-size: 0.6875rem;
    font-weight: 600;
    opacity: 0.65;
    margin-left: 1px;
}

.h-token-pill__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 1px;
    margin-right: -3px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--h-primary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 14px;
    transition: background 0.1s ease, color 0.1s ease;
}

.h-token-pill__remove:hover {
    background: rgba(9, 105, 218, 0.15);
}

.h-token-pill__remove:focus-visible {
    outline: 2px solid var(--h-primary);
    outline-offset: 1px;
}

/* Hidden checkbox (for Django form submission) */
.h-token-pill input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Inline search input */
.h-token-input {
    flex: 1 1 80px;
    min-width: 80px;
    height: 26px;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--h-text);
    padding: 0 2px;
}

.h-token-input::placeholder {
    color: var(--h-text-tertiary);
    font-weight: 400;
}

/* Dropdown */
.h-token-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1.5px solid var(--h-border-strong);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    display: none;
}

.h-token-dropdown.open {
    display: block;
    animation: h-token-drop 0.12s ease-out;
}

@keyframes h-token-drop {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.h-token-dropdown::-webkit-scrollbar { width: 4px; }
.h-token-dropdown::-webkit-scrollbar-track { background: transparent; }
.h-token-dropdown::-webkit-scrollbar-thumb {
    background: var(--h-border-strong);
    border-radius: 2px;
}

.h-token-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 0.8125rem;
    color: var(--h-text);
    cursor: pointer;
    transition: background 0.08s ease;
}

.h-token-option:hover,
.h-token-option.h-token-option--focused {
    background: var(--h-primary-subtle);
}

.h-token-option--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.h-token-option--disabled:hover {
    background: transparent;
}

.h-token-option__role {
    font-size: 0.6875rem;
    color: var(--h-text-tertiary);
    font-weight: 500;
}

.h-token-empty {
    padding: 12px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--h-text-tertiary);
}


/* ─── Frequency Grouping ─── */

/* Icon-only toggle button */
.h-btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    background: var(--h-white);
    color: var(--h-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.h-btn-icon:hover {
    color: var(--h-text);
    border-color: var(--h-primary);
}

.h-btn-icon.active,
.h-btn-icon[aria-pressed="true"] {
    background: var(--h-primary);
    color: var(--h-white);
    border-color: var(--h-primary);
}

@media (max-width: 576px) {
    .h-btn-label-lg {
        display: none;
    }
}

/* Group header row */
.h-group-header td {
    padding: 10px 12px;
    background: var(--h-bg-alt, #f8f9fa);
    border-bottom: 1px solid var(--h-border);
    cursor: pointer;
    user-select: none;
}

.h-group-header:hover td {
    background: #eef0f2;
}

.h-group-chevron {
    display: inline-flex;
    width: 20px;
    justify-content: center;
    margin-right: 6px;
    transition: transform 0.2s ease;
}

.h-group-chevron i {
    font-size: 0.75rem;
    color: var(--h-muted);
}

.h-frequency-group.collapsed .h-group-chevron {
    transform: rotate(-90deg);
}

.h-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--h-text);
}

.h-group-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 8px;
    border-radius: 10px;
    background: var(--h-border);
    color: var(--h-muted);
    font-size: 0.6875rem;
    font-weight: 600;
}

/* Collapse rows within a group */
.h-frequency-group.collapsed tr:not(.h-group-header) {
    display: none;
}

/* Row appear animation */
@keyframes h-row-appear {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .h-frequency-group:not(.collapsed) tr:not(.h-group-header) {
        animation: h-row-appear 0.15s ease-out;
    }
}

/* ==========================================================================
   Subscribe CTA — subscription detail page, no-subscription state
   ========================================================================== */
.h-subscribe-cta { max-width: 520px; }

.h-subscribe-cta__inner {
    background: var(--h-surface);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius-lg);
    padding: var(--h-space-xl, 32px);
}

.h-subscribe-cta__header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.h-subscribe-cta__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--h-primary-subtle);
    color: var(--h-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.h-subscribe-cta__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--h-text);
    margin: 0;
    line-height: 1.2;
}

.h-subscribe-cta__subtitle {
    font-size: 13px;
    color: var(--h-text-tertiary);
    margin: 2px 0 0;
}

.h-subscribe-cta__features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.h-subscribe-cta__features li {
    font-size: 14px;
    color: var(--h-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.h-subscribe-cta__features li i {
    color: var(--h-success);
    font-size: 12px;
    width: 16px;
    text-align: center;
}

.h-subscribe-cta__pricing {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--h-bg);
    border-radius: var(--h-radius);
}

.h-subscribe-cta__price {
    font-size: 16px;
    font-weight: 600;
    color: var(--h-text);
}

.h-subscribe-cta__clients {
    font-size: 13px;
    color: var(--h-text-tertiary);
}

.h-subscribe-cta__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--h-radius);
    margin-bottom: 16px;
}

.h-subscribe-cta__footer {
    font-size: 12px;
    color: var(--h-text-tertiary);
    margin: 0;
    text-align: center;
}
