/**
 * PQS Portal — Shared CSS
 *
 * Covers: Dealer Portal & Sales Portal (and future Admin Portal).
 * Layout: fixed left sidebar + scrollable content area.
 *
 * @package PoolsQuotationSystem
 */

/* ================================================================
   CSS CUSTOM PROPERTIES
   ================================================================ */
:root {
    /* Brand */
    --pqs-primary: #1e40af;
    --pqs-primary-dark: #1e3a8a;
    --pqs-primary-light: #3b82f6;
    --pqs-accent: #2563eb;

    /* Status colours */
    --pqs-success: #16a34a;
    --pqs-warning: #eab308;
    --pqs-danger: #dc2626;
    --pqs-info: #0ea5e9;
    --pqs-orange: #f97316;
    --pqs-purple: #7c3aed;

    /* Neutrals */
    --pqs-bg: #f1f5f9;
    --pqs-surface: #ffffff;
    --pqs-border: #e2e8f0;
    --pqs-text: #1e293b;
    --pqs-text-muted: #64748b;
    --pqs-text-light: #94a3b8;

    /* Sizing */
    --pqs-sidebar-w: 250px;
    --pqs-topbar-h: 60px;
    --pqs-radius: 8px;
    --pqs-radius-sm: 6px;
    --pqs-radius-lg: 12px;

    /* Shadows */
    --pqs-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --pqs-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .06);
    --pqs-shadow-md: 0 4px 6px rgba(0, 0, 0, .1), 0 2px 4px rgba(0, 0, 0, .06);
    --pqs-shadow-lg: 0 10px 15px rgba(0, 0, 0, .1), 0 4px 6px rgba(0, 0, 0, .05);

    /* Transitions */
    --pqs-tr: .2s ease;
    --pqs-tr-slow: .35s ease;
}

/* ================================================================
   RESET — scope everything under .pqs-portal
   ================================================================ */
.pqs-portal,
.pqs-portal *,
.pqs-portal *::before,
.pqs-portal *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.pqs-portal {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--pqs-text);
    background: var(--pqs-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================================================================
   FULL-WIDTH FORCE — break out of any theme container
   ================================================================ */

/* When using the Dashboard Template — hide ALL theme chrome */
body.pqs-dashboard-template #brx-header,
body.pqs-dashboard-template .brxe-header,
body.pqs-dashboard-template #brx-footer,
body.pqs-dashboard-template .brxe-footer,
body.pqs-dashboard-template .brx-header,
body.pqs-dashboard-template .brx-footer,
body.pqs-dashboard-template header.site-header,
body.pqs-dashboard-template footer.site-footer,
body.pqs-dashboard-template #wpadminbar {
    display: none !important;
}

body.pqs-dashboard-template,
body.pqs-dashboard-template html {
    margin: 0 !important;
    padding: 0 !important;
}

/* Override ALL theme wrapper max-widths when portal is present */
body:has(.pqs-portal) .entry-content,
body:has(.pqs-portal) .post-content,
body:has(.pqs-portal) .page-content,
body:has(.pqs-portal) .brxe-post-content,
body:has(.pqs-portal) .brxe-container,
body:has(.pqs-portal) .bricks-layout-wrapper,
body:has(.pqs-portal) .site-content,
body:has(.pqs-portal) .content-area,
body:has(.pqs-portal) main.site-main,
body:has(.pqs-portal) article,
body:has(.pqs-portal) #content,
body:has(.pqs-portal) #main,
body:has(.pqs-portal) .main-content,
body:has(.pqs-portal) .brxe-section,
body:has(.pqs-portal) section.brxe-section {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ================================================================
   TOP BAR
   ================================================================ */
.pqs-topbar {
    height: var(--pqs-topbar-h);
    background: linear-gradient(135deg, var(--pqs-primary), var(--pqs-primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--pqs-shadow-md);
}

.pqs-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pqs-topbar-logo {
    height: 32px;
    width: auto;
    border-radius: 4px;
}

.pqs-topbar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.3px;
}

.pqs-topbar-badge {
    background: rgba(255, 255, 255, .2);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.pqs-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
}

.pqs-hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
}

/* Lucide icons — inline SVG rendered by lucide.createIcons() */
.pqs-lucide {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
}

.pqs-lucide svg {
    width: inherit;
    height: inherit;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Brand link in topbar (clickable → homepage) */
.pqs-topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    transition: opacity var(--pqs-tr);
}

.pqs-topbar-brand:hover {
    opacity: .85;
    color: #fff;
}

/* User link in topbar (clickable → profile) */
.pqs-topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, .9);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--pqs-tr);
}

.pqs-topbar-user:hover {
    color: #fff;
}

.pqs-topbar-logout {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, .8);
    text-decoration: none;
    font-size: 13px;
    transition: color var(--pqs-tr);
}

.pqs-topbar-logout:hover {
    color: #fff;
}

/* ================================================================
   LAYOUT — sidebar + content
   ================================================================ */
.pqs-portal-body {
    display: flex;
    flex: 1;
    min-height: calc(100vh - var(--pqs-topbar-h));
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.pqs-sidebar {
    width: var(--pqs-sidebar-w);
    background: var(--pqs-surface);
    border-right: 1px solid var(--pqs-border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    /* Remove sticky to allow it to natively stretch as a flex item to the full height of the portal body */
    height: auto;
    min-height: calc(100vh - var(--pqs-topbar-h));
    transition: transform var(--pqs-tr-slow);
    z-index: 90;
}

.pqs-sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    position: sticky;
    top: calc(var(--pqs-topbar-h) + 16px);
}

.pqs-sidebar-nav li {
    margin: 0;
}

.pqs-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--pqs-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all var(--pqs-tr);
    white-space: nowrap;
}

.pqs-nav-item:hover {
    background: var(--pqs-bg);
    color: var(--pqs-primary);
}

.pqs-nav-item.active {
    background: #eff6ff;
    color: var(--pqs-primary);
    border-left-color: var(--pqs-primary);
    font-weight: 600;
}

.pqs-nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.pqs-sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--pqs-border);
    margin-top: auto;
    position: sticky;
    bottom: 0;
    background: var(--pqs-surface);
}

.pqs-sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--pqs-danger);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.pqs-sidebar-footer a:hover {
    text-decoration: underline;
}

/* ================================================================
   CONTENT AREA
   ================================================================ */
.pqs-content {
    flex: 1;
    padding: 32px 40px !important;
    min-width: 0;
    overflow-x: hidden;
}

.pqs-content-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--pqs-border);
}

.pqs-content-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--pqs-text);
    margin-bottom: 6px;
}

.pqs-content-header p {
    color: var(--pqs-text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* ================================================================
   STAT CARDS — 4-column grid
   ================================================================ */
.pqs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.pqs-stat-card {
    background: var(--pqs-surface);
    border-radius: var(--pqs-radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--pqs-shadow);
    border-left: 4px solid var(--pqs-border);
    transition: transform var(--pqs-tr), box-shadow var(--pqs-tr);
}

.pqs-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--pqs-shadow-md);
}

.pqs-stat-card .pqs-stat-info {
    display: flex;
    flex-direction: column;
}

.pqs-stat-number {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
}

.pqs-stat-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--pqs-text-muted);
    margin-top: 4px;
}

.pqs-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--pqs-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

/* Card colour variants */
.pqs-stat-blue {
    border-left-color: var(--pqs-primary);
}

.pqs-stat-blue .pqs-stat-number {
    color: var(--pqs-primary);
}

.pqs-stat-blue .pqs-stat-icon {
    background: #dbeafe;
    color: var(--pqs-primary);
}

.pqs-stat-yellow {
    border-left-color: var(--pqs-warning);
}

.pqs-stat-yellow .pqs-stat-number {
    color: var(--pqs-warning);
}

.pqs-stat-yellow .pqs-stat-icon {
    background: #fef9c3;
    color: var(--pqs-warning);
}

.pqs-stat-green {
    border-left-color: var(--pqs-success);
}

.pqs-stat-green .pqs-stat-number {
    color: var(--pqs-success);
}

.pqs-stat-green .pqs-stat-icon {
    background: #dcfce7;
    color: var(--pqs-success);
}

.pqs-stat-orange {
    border-left-color: var(--pqs-orange);
}

.pqs-stat-orange .pqs-stat-number {
    color: var(--pqs-orange);
}

.pqs-stat-orange .pqs-stat-icon {
    background: #ffedd5;
    color: var(--pqs-orange);
}

.pqs-stat-purple {
    border-left-color: var(--pqs-purple);
}

.pqs-stat-purple .pqs-stat-number {
    color: var(--pqs-purple);
}

.pqs-stat-purple .pqs-stat-icon {
    background: #ede9fe;
    color: var(--pqs-purple);
}

/* ================================================================
   TABLES
   ================================================================ */
.pqs-table-wrap {
    background: var(--pqs-surface);
    border-radius: var(--pqs-radius-lg);
    box-shadow: var(--pqs-shadow);
    overflow: hidden;
    margin-bottom: 20px;
    max-width: 100%;
}

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

.pqs-table-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.pqs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pqs-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--pqs-text-muted);
    background: #f8fafc;
    border-bottom: 2px solid var(--pqs-border);
    white-space: nowrap;
}

.pqs-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--pqs-border);
    vertical-align: middle;
}

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

.pqs-table tbody tr:hover {
    background: #f8fafc;
}

.pqs-table .pqs-ref {
    font-weight: 700;
    color: var(--pqs-primary);
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 12px;
}

.pqs-table .pqs-price {
    font-weight: 600;
    white-space: nowrap;
}

.pqs-table .pqs-actions {
    white-space: nowrap;
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ================================================================
   BADGES
   ================================================================ */
.pqs-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    line-height: 1.4;
}

.pqs-badge-success {
    background: #dcfce7;
    color: #15803d;
}

.pqs-badge-warning {
    background: #fef9c3;
    color: #a16207;
}

.pqs-badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.pqs-badge-primary {
    background: #ede9fe;
    color: #6d28d9;
}

.pqs-badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.pqs-badge-secondary {
    background: #f1f5f9;
    color: var(--pqs-text-muted);
}

.pqs-badge-install {
    background: #dbeafe;
    color: #1d4ed8;
}

.pqs-badge-diy {
    background: #fef9c3;
    color: #a16207;
}

.pqs-badge-relining {
    background: #fce7f3;
    color: #be185d;
}

/* Lead source badges (attribution) */
.pqs-badge-source-google   { background: #e8f0fe; color: #1a73e8; }
.pqs-badge-source-meta     { background: #eaf3ff; color: #0866ff; }
.pqs-badge-source-organic  { background: #dcfce7; color: #15803d; }
.pqs-badge-source-referral { background: #ffedd5; color: #c2410c; }
.pqs-badge-source-direct   { background: #f1f5f9; color: var(--pqs-text-muted); }

/* ================================================================
   BUTTONS
   ================================================================ */
.pqs-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--pqs-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--pqs-tr);
    line-height: 1.4;
    white-space: nowrap;
    font-family: inherit;
}

.pqs-btn:focus {
    outline: 2px solid var(--pqs-primary-light);
    outline-offset: 2px;
}

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

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

.pqs-btn-secondary {
    background: #f1f5f9;
    color: var(--pqs-text);
    border: 1px solid var(--pqs-border);
}

.pqs-btn-secondary:hover {
    background: #e2e8f0;
    color: var(--pqs-text);
}

.pqs-btn-danger {
    background: var(--pqs-danger);
    color: #fff;
}

.pqs-btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

.pqs-btn-success {
    background: var(--pqs-success);
    color: #fff;
}

.pqs-btn-success:hover {
    background: #15803d;
    color: #fff;
}

.pqs-btn-warning {
    background: var(--pqs-warning);
    color: #1e293b;
}

.pqs-btn-warning:hover {
    background: #ca8a04;
}

.pqs-btn-ghost {
    background: transparent;
    color: var(--pqs-primary);
}

.pqs-btn-ghost:hover {
    background: #eff6ff;
}

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

.pqs-btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

.pqs-btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

.pqs-btn:disabled,
.pqs-btn.is-loading {
    opacity: .6;
    pointer-events: none;
}

.pqs-btn.is-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pqs-spin .6s linear infinite;
    margin-left: 6px;
}

.pqs-btn-secondary.is-loading::after {
    border-color: rgba(0, 0, 0, .2);
    border-top-color: var(--pqs-text);
}

/* ================================================================
   FILTER BAR
   ================================================================ */
.pqs-filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 16px 20px;
    background: var(--pqs-surface);
    border-radius: var(--pqs-radius-lg);
    box-shadow: var(--pqs-shadow);
    margin-bottom: 20px;
}

.pqs-filter-bar .pqs-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pqs-filter-bar label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--pqs-text-muted);
}

/* ================================================================
   FORMS & INPUTS
   ================================================================ */
.pqs-input,
.pqs-textarea,
.pqs-select {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--pqs-border);
    border-radius: var(--pqs-radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--pqs-text);
    background: var(--pqs-surface);
    transition: border-color var(--pqs-tr), box-shadow var(--pqs-tr);
}

.pqs-input:focus,
.pqs-textarea:focus,
.pqs-select:focus {
    outline: none;
    border-color: var(--pqs-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

.pqs-input::placeholder {
    color: var(--pqs-text-light);
}

.pqs-form-section {
    background: var(--pqs-surface);
    border-radius: var(--pqs-radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--pqs-shadow);
}

.pqs-form-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--pqs-border);
}

.pqs-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.pqs-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pqs-form-field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--pqs-text);
}

.pqs-field-wide {
    grid-column: 1 / -1;
}

.pqs-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--pqs-border);
}

/* Price input with currency prefix */
.pqs-price-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--pqs-border);
    border-radius: var(--pqs-radius-sm);
    overflow: hidden;
    transition: border-color var(--pqs-tr), box-shadow var(--pqs-tr);
}

.pqs-price-input-wrap:focus-within {
    border-color: var(--pqs-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

.pqs-currency {
    padding: 9px 12px;
    background: #f8fafc;
    font-weight: 600;
    color: var(--pqs-text-muted);
    font-size: 14px;
    border-right: 1px solid var(--pqs-border);
}

.pqs-price-input {
    border: none !important;
    box-shadow: none !important;
    flex: 1;
}

/* ================================================================
   DETAIL VIEW — two-column grid
   ================================================================ */
.pqs-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.pqs-detail-section {
    background: var(--pqs-surface);
    border-radius: var(--pqs-radius-lg);
    box-shadow: var(--pqs-shadow);
    padding: 20px 24px;
}

.pqs-detail-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--pqs-border);
}

.pqs-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.pqs-detail-table th,
.pqs-detail-table td {
    padding: 8px 0;
    font-size: 13px;
    vertical-align: top;
    border-bottom: 1px solid #f1f5f9;
}

.pqs-detail-table th {
    width: 140px;
    color: var(--pqs-text-muted);
    font-weight: 500;
    text-align: left;
}

.pqs-detail-table a {
    color: var(--pqs-primary);
    text-decoration: none;
}

.pqs-detail-table a:hover {
    text-decoration: underline;
}

/* ================================================================
   ACTION BAR (enquiry detail buttons)
   ================================================================ */
.pqs-action-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* ================================================================
   PAGINATION
   ================================================================ */
.pqs-pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 20px 0;
}

.pqs-page-btn {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--pqs-radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--pqs-text);
    background: var(--pqs-surface);
    border: 1px solid var(--pqs-border);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--pqs-tr);
}

.pqs-page-btn:hover {
    background: #eff6ff;
    border-color: var(--pqs-primary-light);
    color: var(--pqs-primary);
}

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

/* ================================================================
   RESULT COUNT
   ================================================================ */
.pqs-result-count {
    font-size: 13px;
    color: var(--pqs-text-muted);
    margin-bottom: 12px;
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.pqs-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--pqs-text-muted);
}

.pqs-empty-state .pqs-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: .5;
}

.pqs-empty-state p {
    font-size: 15px;
}

/* ================================================================
   NOTICES
   ================================================================ */
.pqs-notice {
    padding: 12px 16px;
    border-radius: var(--pqs-radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pqs-notice-success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.pqs-notice-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.pqs-notice-info {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.pqs-notice-warning {
    background: #fef9c3;
    color: #a16207;
    border: 1px solid #fde68a;
}

/* ================================================================
   MODAL / POPUP
   ================================================================ */
.pqs-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}

.pqs-modal-overlay.is-open {
    display: flex;
}

.pqs-modal {
    background: var(--pqs-surface);
    border-radius: var(--pqs-radius-lg);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--pqs-shadow-lg);
    animation: pqs-modal-in .25s ease;
}

.pqs-modal-lg {
    max-width: 960px;
}

.pqs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--pqs-border);
    position: sticky;
    top: 0;
    background: var(--pqs-surface);
    z-index: 1;
    border-radius: var(--pqs-radius-lg) var(--pqs-radius-lg) 0 0;
}

.pqs-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.pqs-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: var(--pqs-text-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--pqs-tr);
}

.pqs-modal-close:hover {
    background: #fee2e2;
    color: var(--pqs-danger);
}

.pqs-modal-body {
    padding: 24px;
}

.pqs-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--pqs-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
.pqs-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.pqs-toast {
    padding: 14px 20px;
    border-radius: var(--pqs-radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--pqs-shadow-lg);
    pointer-events: all;
    animation: pqs-toast-in .3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 380px;
    color: #fff;
}

.pqs-toast-success {
    background: var(--pqs-success);
}

.pqs-toast-error {
    background: var(--pqs-danger);
}

.pqs-toast-info {
    background: var(--pqs-info);
}

.pqs-toast-warning {
    background: #f59e0b;
    color: #1e293b;
}

.pqs-toast.is-leaving {
    animation: pqs-toast-out .3s ease forwards;
}

/* ================================================================
   LOADING / SKELETON
   ================================================================ */
.pqs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 12px;
    color: var(--pqs-text-muted);
    font-size: 14px;
}

.pqs-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--pqs-border);
    border-top-color: var(--pqs-primary);
    border-radius: 50%;
    animation: pqs-spin .7s linear infinite;
}

.pqs-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: pqs-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--pqs-radius-sm);
    height: 16px;
}

/* ================================================================
   LOGO PREVIEW
   ================================================================ */
.pqs-logo-preview {
    max-width: 160px;
    max-height: 80px;
    border-radius: var(--pqs-radius-sm);
    border: 1px solid var(--pqs-border);
    object-fit: contain;
    margin-bottom: 8px;
}

/* ================================================================
   DASHBOARD GRID — two-column layout (recent quotes + quick links)
   ================================================================ */
.pqs-dashboard-grid {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 24px;
    margin-top: 24px;
}

/* Grid items default to min-width:auto, which stops them shrinking below
   the intrinsic width of their content (e.g. the Recent Quotes table).
   Without this, the table pushes the grid -- and the page -- wider than the
   viewport on mobile instead of scrolling inside its own card, which is
   what makes the Date/Actions columns look clipped/overlapping on phones. */
.pqs-dashboard-grid > * {
    min-width: 0;
}

@media (max-width: 1024px) {
    .pqs-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Recent Quotes card */
.pqs-recent-quotes {
    background: var(--pqs-surface);
    border-radius: var(--pqs-radius-lg);
    box-shadow: var(--pqs-shadow);
    padding: 24px;
}

.pqs-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.pqs-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.pqs-link {
    color: var(--pqs-primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--pqs-tr);
    cursor: pointer;
}

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

/* Compact table variant for dashboard widgets */
.pqs-table-compact th,
.pqs-table-compact td {
    padding: 8px 12px;
    font-size: 13px;
}

.pqs-table-compact th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--pqs-text-muted);
}

/* Small button variant */
.pqs-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    gap: 4px;
}

/* ================================================================
   QUICK LINKS (dashboard)
   ================================================================ */
.pqs-quick-links {
    background: var(--pqs-surface);
    border-radius: var(--pqs-radius-lg);
    box-shadow: var(--pqs-shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.pqs-quick-links h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.pqs-quick-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--pqs-radius-sm);
    cursor: pointer;
    transition: background var(--pqs-tr);
    text-decoration: none;
    color: var(--pqs-text);
}

.pqs-quick-link-item:hover {
    background: #f8fafc;
}

.pqs-quick-link-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--pqs-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: #eff6ff;
    color: var(--pqs-primary);
}

.pqs-quick-link-info {
    flex: 1;
}

.pqs-quick-link-info strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

.pqs-quick-link-info small {
    color: var(--pqs-text-muted);
    font-size: 12px;
}

.pqs-quick-link-arrow {
    color: var(--pqs-text-light);
    font-size: 16px;
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes pqs-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pqs-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes pqs-modal-in {
    from {
        opacity: 0;
        transform: scale(.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pqs-toast-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pqs-toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

@keyframes pqs-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pqs-fade-in {
    animation: pqs-fade-in .3s ease;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
    .pqs-content {
        padding: 20px 16px;
    }

    .pqs-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .pqs-sidebar {
        position: fixed;
        top: var(--pqs-topbar-h);
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: var(--pqs-shadow-lg);
    }

    .pqs-sidebar.is-open {
        transform: translateX(0);
    }

    .pqs-hamburger {
        display: block;
    }

    .pqs-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .pqs-stat-card {
        padding: 14px 16px;
    }

    .pqs-stat-number {
        font-size: 24px;
    }

    .pqs-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .pqs-filter-bar {
        flex-direction: column;
    }

    .pqs-table-wrap {
        overflow-x: auto;
    }

    .pqs-form-grid {
        grid-template-columns: 1fr;
    }

    .pqs-modal {
        max-width: 100%;
        margin: 10px;
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .pqs-stats-grid {
        grid-template-columns: 1fr;
    }

    .pqs-topbar {
        padding: 0 12px;
    }

    .pqs-topbar-badge {
        display: none;
    }

    .pqs-content {
        padding: 16px 12px;
    }
}

/* ================================================================
   SALES PORTAL -- SHARED MOBILE STYLES
   Loads globally (was previously only injected on the Enquiries tab,
   so Dashboard/Revision tabs opened directly -- e.g. from a bookmark or
   shared link -- never received this CSS and rendered unstyled/squashed).
   ================================================================ */

/* Reduce content padding on small screens */
@media (max-width: 640px) {
    .pqs-content { padding: 16px 14px !important; }
    .pqs-content-header { margin-bottom: 12px; }
    .pqs-content-header h1 { font-size: 20px; margin-bottom: 2px; }
    .pqs-content-header p { font-size: 13px; margin: 0; }
}

/* -- Filter bar: 2-column grid on mobile -- */
@media (max-width: 640px) {
    .pqs-filter-bar {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    /* Search spans full width */
    .pqs-filter-bar .pqs-filter-group:first-child { grid-column: 1 / -1; }
    /* Filter + Reset buttons side by side */
    .pqs-filter-bar .pqs-filter-group:nth-last-child(1),
    .pqs-filter-bar .pqs-filter-group:nth-last-child(2) {
        grid-column: span 1;
        align-self: end;
    }
    .pqs-filter-bar .pqs-filter-group { flex-direction: column; }
    .pqs-filter-bar label { font-size: 11px; font-weight: 600;
        text-transform: uppercase; color: #555; margin-bottom: 4px; }
    .pqs-filter-bar .pqs-btn { width: 100%; justify-content: center; }
}
@media (min-width: 641px) and (max-width: 900px) {
    .pqs-filter-bar { display: grid !important; grid-template-columns: 1fr 1fr 1fr !important; gap: 8px !important; }
    .pqs-filter-bar .pqs-filter-group:first-child { grid-column: 1 / -1; }
}
/* Date inputs need more room than the 2-col grid gives them on small
   phones -- the native calendar icon + yyyy/mm/dd text overlaps when the
   box gets too narrow. Give From/To their own full-width row below 480px. */
@media (max-width: 480px) {
    .pqs-filter-bar .pqs-filter-group:nth-child(2),
    .pqs-filter-bar .pqs-filter-group:nth-child(3) {
        grid-column: 1 / -1;
    }
}
.pqs-input[type="date"] {
    min-width: 0;
}

/* -- Enquiry cards -- */
.pqs-enquiry-cards { display: flex; flex-direction: column; gap: 10px; }
.pqs-enquiry-card {
    display: block; background: #fff;
    border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px 16px;
    text-decoration: none; color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: box-shadow .15s, border-color .15s;
    cursor: pointer;
}
.pqs-enquiry-card:active { box-shadow: 0 1px 6px rgba(0,0,0,.15); background: #f8fafc; }
.pqs-ec-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 5px; }
.pqs-ec-ref { font-size: 12px; font-weight: 700; color: #1e3a5f; font-family: monospace; }
.pqs-ec-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pqs-ec-name { font-size: 15px; font-weight: 600; color: #1a202c; margin-bottom: 4px; }
.pqs-ec-meta { display: flex; justify-content: space-between;
    font-size: 13px; color: #555; margin-bottom: 8px; gap: 8px; }
.pqs-ec-pool { color: #555; }
.pqs-ec-price { font-weight: 700; color: #1e3a5f; white-space: nowrap; }
.pqs-ec-footer { display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid #f0f0f0; padding-top: 8px; margin-top: 4px; }
.pqs-ec-date { font-size: 12px; color: #888; }
.pqs-ec-actions { display: flex; gap: 6px; }
.pqs-btn-xs { padding: 4px 8px !important; font-size: 11px !important; line-height: 1.4; }
@media (min-width: 641px) {
    .pqs-enquiry-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}
@media (min-width: 1024px) {
    .pqs-enquiry-cards { grid-template-columns: 1fr 1fr 1fr; }
}

/* -- Revision form mobile -- */
.pqs-rev-customer-strip {
    display: flex; align-items: center; justify-content: space-between;
    background: #1e3a5f; color: #fff;
    padding: 12px 16px; border-radius: 8px; margin-bottom: 12px;
    gap: 12px;
}
.pqs-rev-customer-name { font-size: 15px; font-weight: 700; display: block; }
.pqs-rev-customer-contact { font-size: 12px; opacity: .8; display: block; margin-top: 2px; }
.pqs-rev-factory-badge {
    font-size: 11px; background: rgba(255,255,255,.15);
    padding: 5px 10px; border-radius: 6px; text-align: right;
    white-space: nowrap; flex-shrink: 0;
}
.pqs-form-section--compact {
    padding: 14px 16px; border-bottom: 1px solid #eee; margin-bottom: 0 !important;
}
.pqs-form-section--compact:last-of-type { border-bottom: none; }
.pqs-section-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: #1e3a5f; margin-bottom: 8px;
}
.pqs-select--large { font-size: 16px !important; padding: 12px !important; height: auto !important; }
.pqs-extra-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 4px; }
.pqs-extra-input-label { display: block; font-size: 11px; font-weight: 600; color: #666; margin-bottom: 4px; }
.pqs-extra-qty, .pqs-extra-price { width: 100% !important; }
.pqs-extra-note { font-size: 12px; color: #888; margin: 2px 0 0; }

/* Optional Extras rows (e.g. Heating, Filtration) -- extra breathing room
   between the checkbox/name/badge and the row below it. */
.pqs-extra-row { padding: 14px 4px; border-bottom: 1px solid #f4f4f4; }
.pqs-extra-row:last-child { border-bottom: none; }
.pqs-extra-detail { padding: 4px 0 0 0; }
.pqs-extra-header {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
}
.pqs-extra-desc {
    display: block; width: 100%; font-size: 12px; margin-top: 2px;
}

.pqs-checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.pqs-checkbox-label {
    display: flex; align-items: center; gap: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 8px; padding: 10px 14px; cursor: pointer; font-size: 14px;
    min-height: 44px;
    transition: background .15s, border-color .15s;
}
.pqs-checkbox-label:hover { background: #eef2f7; border-color: #cbd5e1; }
.pqs-checkbox-label input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }

/* "Supply Only" / "Supply & Install" pill -- previously missing the base
   .pqs-badge padding/shape rules, so it rendered as plain highlighted text
   crammed against the item name instead of a proper button-style pill. */
.pqs-supply-fit-badge {
    display: inline-flex; align-items: center;
    padding: 4px 11px; border-radius: 20px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .3px; line-height: 1.4; white-space: nowrap;
}

.pqs-rev-action-bar {
    position: sticky; bottom: 0; background: #fff;
    border-top: 1px solid #e2e8f0; padding: 12px 0 16px;
    display: flex; gap: 10px; margin-top: 8px; z-index: 10;
}
.pqs-btn-back { flex: 0 0 auto; }
.pqs-btn-generate { flex: 1 !important; font-size: 15px !important; padding: 13px !important; justify-content: center; }

/* ── Extras Group Accordion (C4) ────────────────────────────────────────── */

.pqs-extras-group {
    margin-bottom: 6px;
    border: 1px solid #b8d4ef;
    border-radius: 6px;
    overflow: hidden;
}

.pqs-extras-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    background: #EBF5FB;
    border: none;
    border-radius: 0;
    font-weight: 700;
    font-size: 14px;
    color: #1a4d7c;
    cursor: pointer;
    text-align: left;
    gap: 8px;
}

.pqs-extras-group-toggle:hover {
    background: #d6eaf8;
}

.pqs-extras-group-title {
    flex: 1;
}

.pqs-extras-group-badge {
    background: #2E86C1;
    color: #fff;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    margin-right: 4px;
}

.pqs-extras-group-badge:empty {
    display: none;
}

.pqs-extras-group-chevron {
    font-size: 10px;
    color: #2E86C1;
    transition: transform .2s ease;
}

.pqs-extras-open .pqs-extras-group-chevron {
    transform: rotate(180deg);
}

.pqs-extras-group-body {
    padding: 8px 12px 12px;
    background: #fff;
}