/**
 * PWS ERP Application Styles
 * Standalone styles for router-based frontend (no theme dependency)
 */

/* =====================================================
   CSS VARIABLES
   ===================================================== */
:root {
    --pws-primary: #0a6e7c;
    --pws-primary-dark: #085a66;
    --pws-primary-light: #e8f4f6;
    --pws-text: #1d2327;
    --pws-text-muted: #666;
    --pws-bg: #f0f2f5;
    --pws-white: #fff;
    --pws-border: #e0e0e0;
    --pws-nav-section-border: #e0e0e0;
    --pws-nav-item-border: transparent;
    --pws-success: #27ae60;
    --pws-warning: #f39c12;
    --pws-danger: #e74c3c;
    --pws-sidebar-width: 220px;
    --pws-sidebar-bg: #ffffff;
    --pws-sidebar-text: #1d2327;
    --pws-sidebar-hover-bg: #ebebeb;
    --pws-sidebar-hover-text: #1d2327;
    --pws-sidebar-active-bg: #e8f4f6;
    --pws-sidebar-active-text: #0a6e7c;
    --pws-sidebar-active-accent: #0a6e7c;
    --pws-sidebar-active-group-bg: transparent;
    --pws-sidebar-active-group-text: #0a6e7c;
    --pws-nav-item-height: 38px;
    --pws-nav-header-height: 42px;
    --pws-nav-submenu-height: 36px;
    --pws-header-text: #6c757d;
    --pws-header-text-hover: #1d2327;
    --pws-header-bg: #ffffff;
    --pws-header-height: 56px;
    --pws-mobile-menu-color: #1d2327;
    --pws-mobile-menu-hover: #000000;
    --pws-footer-font-size: 11px;
    --pws-footer-text-color: #999999;
    --pws-radius: 8px;
    --pws-radius-sm: 4px;
    --pws-font-size: 14px;
    --pws-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --pws-content-width: 100%;
    --pws-font-base: 14px;
    --pws-font-small: 12px;
    --pws-font-xs: 11px;
    --pws-font-h1: 24px;
    --pws-font-h2: 20px;
    --pws-font-h3: 16px;
    --pws-font-h4: 15px;
    --pws-font-sidebar: 14px;
    --pws-font-table: 13px;
    --pws-font-table-head: 11px;
    --pws-font-button: 14px;
    --pws-font-input: 14px;
    --pws-weight-base: 400;
    --pws-weight-small: 400;
    --pws-weight-h1: 600;
    --pws-weight-h2: 600;
    --pws-weight-h3: 600;
    --pws-weight-h4: 600;
    --pws-weight-sidebar: 400;
    --pws-weight-table: 400;
    --pws-weight-table-head: 600;
    --pws-weight-button: 500;
    --pws-weight-input: 400;
    --pws-font-heading: inherit;
    --pws-font-nav: inherit;
    --pws-font-content: inherit;
    --pws-font-btn: inherit;
    --pws-logo-width: 260px;
    --pws-logo-height: auto;
    --pws-logo-padding-top: 12px;
    --pws-logo-padding-bottom: 12px;
    --pws-logo-padding-left: 16px;
    --pws-logo-padding-right: 16px;
}

/* =====================================================
   RESET / BASE
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body.pws-erp-app {
    margin: 0;
    padding: 0;
    font-family: var(--pws-font-family);
    font-size: var(--pws-font-base);
    font-weight: var(--pws-weight-base);
    line-height: 1.5;
    color: var(--pws-text);
    background: var(--pws-bg);
}

/* =====================================================
   CUSTOM SCROLLBAR
   ===================================================== */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(10, 110, 124, 0.25) transparent;
}

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(10, 110, 124, 0.2);
    border-radius: 10px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 110, 124, 0.45);
}

/* Show slightly wider scrollbar on hover for sidebar & main */
.pws-app-sidebar::-webkit-scrollbar,
.pws-app-main::-webkit-scrollbar {
    width: 5px;
}

.pws-app-sidebar::-webkit-scrollbar-thumb,
.pws-app-main::-webkit-scrollbar-thumb {
    background: rgba(10, 110, 124, 0.15);
    border-radius: 10px;
}

.pws-app-sidebar:hover::-webkit-scrollbar-thumb,
.pws-app-main:hover::-webkit-scrollbar-thumb {
    background: rgba(10, 110, 124, 0.35);
}

/* Sidebar Firefox */
.pws-app-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(10, 110, 124, 0.15) transparent;
}

/* Remove scrollbar corner gap */
::-webkit-scrollbar-corner {
    background: transparent;
}

a {
    color: var(--pws-primary);
    text-decoration: none;
}

a:hover {
    color: var(--pws-primary-dark);
    text-decoration: underline;
}

/* =====================================================
   APP LAYOUT
   ===================================================== */
.pws-app-wrapper {
    display: grid;
    grid-template-columns: var(--pws-sidebar-width) 1fr;
    grid-template-rows: var(--pws-header-height) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    min-height: 100vh;
}

/* Header */
.pws-app-header {
    grid-area: header;
    background: var(--pws-header-bg);
    border-bottom: 1px solid var(--pws-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.pws-header-spacer {
    flex: 1;
}

.pws-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.pws-user-name {
    font-size: var(--pws-font-table);
    color: var(--pws-header-text, var(--pws-text-muted));
    transition: color 0.2s;
}

.pws-user-name:hover {
    color: var(--pws-header-text-hover, var(--pws-text));
}

.pws-logout-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--pws-header-text, var(--pws-text-muted));
    transition: all 0.2s;
}

.pws-logout-btn:hover {
    background: var(--pws-bg);
    color: var(--pws-header-text-hover, var(--pws-danger));
    text-decoration: none;
}

.pws-header-settings-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--pws-header-text, var(--pws-text-muted));
    transition: all 0.2s;
}

.pws-header-settings-btn:hover {
    background: var(--pws-bg);
    color: var(--pws-header-text-hover, var(--pws-primary));
    text-decoration: none;
}

.pws-mobile-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--pws-mobile-menu-color, var(--pws-text));
    transition: color 0.2s;
}

.pws-mobile-toggle:hover,
.pws-mobile-toggle:active {
    color: var(--pws-mobile-menu-hover, var(--pws-text));
}

/* Sidebar */
.pws-app-sidebar {
    grid-area: sidebar;
    grid-row: 1 / -1;
    background: var(--pws-sidebar-bg);
    border-right: 1px solid var(--pws-border);
    border-inline-end: 1px solid var(--pws-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* Sidebar Logo */
.pws-sidebar-logo {
    padding: var(--pws-logo-padding-top, 12px) var(--pws-logo-padding-right, 16px) var(--pws-logo-padding-bottom, 12px) var(--pws-logo-padding-left, 16px);
    border-bottom: 1px solid var(--pws-border);
    flex-shrink: 0;
}

.pws-sidebar-logo-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.pws-sidebar-logo-link:hover {
    opacity: 0.8;
}

.pws-sidebar-logo-link:focus {
    outline: 2px solid var(--pws-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.pws-sidebar-logo-img {
    display: block;
    max-width: var(--pws-logo-width, 260px);
    height: var(--pws-logo-height, auto);
    width: auto;
}

.pws-sidebar-logo-text {
    display: block;
    font-size: var(--pws-font-h3);
    font-weight: var(--pws-weight-h3);
    font-family: var(--pws-font-nav);
    color: var(--pws-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pws-sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.pws-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.pws-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 4px;
}

/* ── Nav Sections (group wrapper) ── */
.pws-nav-section {
    border-bottom: 1px solid var(--pws-nav-section-border, var(--pws-border, rgba(0,0,0,0.06)));
}

.pws-nav-section:last-child {
    border-bottom: none;
}

/* ── Nav Items (links) ── */
.pws-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    min-height: var(--pws-nav-header-height, var(--pws-nav-item-height, 42px));
    font-size: var(--pws-font-sidebar, 13px);
    font-weight: var(--pws-weight-sidebar, 400);
    font-family: var(--pws-font-nav);
    color: var(--pws-sidebar-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid var(--pws-nav-item-border, transparent);
    border-inline-start: 3px solid var(--pws-nav-item-border, transparent);
    box-sizing: border-box;
}

.pws-nav-item:hover {
    background: var(--pws-sidebar-hover-bg);
    color: var(--pws-sidebar-hover-text);
    text-decoration: none;
}

.pws-nav-item.active {
    background: var(--pws-sidebar-active-bg, var(--pws-primary-light));
    color: var(--pws-sidebar-active-text, var(--pws-primary));
    font-weight: 600;
    border-left-color: var(--pws-sidebar-active-accent, var(--pws-primary));
    border-inline-start-color: var(--pws-sidebar-active-accent, var(--pws-primary));
}

.pws-nav-item .dashicons {
    font-size: 18px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    flex-shrink: 0;
    color: inherit;
    opacity: 0.7;
    overflow: hidden; /* Prevent fallback glyphs from overflowing during font load */
}

.pws-nav-item.active .dashicons {
    opacity: 1;
}

/* ── Group (details/summary) ── */
.pws-nav-group {
    margin: 0;
}

.pws-nav-group > summary {
    list-style: none;
}

.pws-nav-group > summary::-webkit-details-marker {
    display: none;
}

.pws-nav-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 19px;
    padding-inline: 19px 16px;
    min-height: var(--pws-nav-header-height, var(--pws-nav-item-height, 42px));
    font-size: var(--pws-font-sidebar, 13px);
    font-weight: 600;
    font-family: var(--pws-font-nav);
    letter-spacing: 0.01em;
    color: var(--pws-sidebar-text);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    box-sizing: border-box;
}

.pws-nav-group-header:hover {
    background: var(--pws-sidebar-hover-bg);
    color: var(--pws-sidebar-hover-text);
}

.pws-nav-group-header:focus-visible {
    outline: 2px solid var(--pws-primary);
    outline-offset: -2px;
    border-radius: 2px;
}

.pws-nav-group-header.pws-group-active {
    background: var(--pws-sidebar-active-group-bg, transparent);
    color: var(--pws-sidebar-active-group-text, var(--pws-primary));
}

.pws-nav-group-header .dashicons {
    font-size: 18px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    flex-shrink: 0;
    color: inherit;
    opacity: 0.6;
    overflow: hidden; /* Prevent fallback glyphs from overflowing during font load */
}

.pws-nav-group-header.pws-group-active .dashicons {
    opacity: 1;
}

/* ── Chevron (SVG) ── */
.pws-nav-chevron {
    margin-left: auto;
    margin-inline-start: auto;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    opacity: 0.35;
    transition: transform 0.2s ease, opacity 0.15s;
}

.pws-nav-group-header:hover .pws-nav-chevron {
    opacity: 0.6;
}

.pws-nav-group[open] > .pws-nav-group-header .pws-nav-chevron {
    transform: rotate(180deg);
    opacity: 0.5;
}

/* ── Child items ── */
.pws-nav-group-items {
    padding: 0 0 4px 0;
}

.pws-nav-item-child {
    padding-left: 49px;
    padding-inline-start: 49px;
    min-height: var(--pws-nav-submenu-height, var(--pws-nav-item-height, 36px));
    font-size: calc(var(--pws-font-sidebar, 13px) - 0.5px);
    font-weight: var(--pws-weight-sidebar, 400);
    border-left: 3px solid var(--pws-nav-item-border, transparent);
    border-inline-start: 3px solid var(--pws-nav-item-border, transparent);
    position: relative;
}

/* Subtle connector dot for child items */
.pws-nav-item-child::before {
    content: '';
    position: absolute;
    left: 32px;
    inset-inline-start: 32px;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.2;
    transition: opacity 0.15s;
}

.pws-nav-item-child:hover::before {
    opacity: 0.4;
}

.pws-nav-item-child.active::before {
    background: var(--pws-sidebar-active-accent, var(--pws-primary));
    opacity: 0.8;
}

/* ── Collapsed sidebar: flyout menus ── */
.pws-sidebar-collapsed .pws-nav-chevron,
.pws-sidebar-icon-only .pws-nav-chevron {
    display: none;
}

.pws-sidebar-collapsed .pws-nav-group-header,
.pws-sidebar-icon-only .pws-nav-group-header {
    justify-content: center;
    padding: 10px;
    border-left: none;
    border-inline-start: none;
}

.pws-sidebar-collapsed .pws-nav-group,
.pws-sidebar-icon-only .pws-nav-group {
    position: relative;
}

.pws-sidebar-collapsed .pws-nav-group-items,
.pws-sidebar-icon-only .pws-nav-group-items {
    display: none;
}

/* Override open state in collapsed/icon-only — only flyout on hover */
.pws-sidebar-collapsed .pws-nav-group[open] > .pws-nav-group-items,
.pws-sidebar-icon-only .pws-nav-group[open] > .pws-nav-group-items {
    display: none;
}

.pws-sidebar-collapsed .pws-nav-group:hover > .pws-nav-group-items,
.pws-sidebar-icon-only .pws-nav-group:hover > .pws-nav-group-items {
    display: block;
    position: absolute;
    left: 100%;
    inset-inline-start: 100%;
    top: 0;
    min-width: 200px;
    background: var(--pws-sidebar-bg, #fff);
    border: 1px solid var(--pws-border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 6px 0;
    z-index: 1000;
}

.pws-sidebar-collapsed .pws-nav-group-items .pws-nav-item-child,
.pws-sidebar-icon-only .pws-nav-group-items .pws-nav-item-child {
    padding-left: 16px;
    padding-inline-start: 16px;
    border-left: none;
    border-inline-start: none;
}

.pws-sidebar-collapsed .pws-nav-group-items .pws-nav-item-child::before,
.pws-sidebar-icon-only .pws-nav-group-items .pws-nav-item-child::before {
    display: none;
}

.pws-sidebar-collapsed .pws-nav-group-items .pws-nav-item-child.active,
.pws-sidebar-icon-only .pws-nav-group-items .pws-nav-item-child.active {
    border-left: none;
    border-inline-start: none;
    border-radius: 4px;
    margin: 0 4px;
    padding-left: 12px;
    padding-inline-start: 12px;
}

.pws-sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--pws-border);
    font-size: var(--pws-footer-font-size);
    color: var(--pws-footer-text-color);
}
.pws-sidebar-footer small,
.pws-sidebar-footer a,
.pws-sidebar-footer span {
    font-size: inherit;
}
.pws-footer-link {
    color: var(--pws-footer-text-color);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.15s;
}
.pws-footer-link:hover {
    opacity: 1;
}

.pws-powered-by {
    display: block;
    margin-top: 4px;
    opacity: 0.6;
}

/* Sidebar Collapse Button */
.pws-sidebar-collapse-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--pws-header-text, var(--pws-text-muted));
    margin-right: 4px;
    margin-inline-end: 4px;
    transition: color 0.2s;
}

.pws-sidebar-collapse-btn:hover {
    color: var(--pws-header-text-hover, var(--pws-text));
}

.pws-sidebar-collapsible .pws-sidebar-collapse-btn {
    display: flex;
    align-items: center;
}

/* Sidebar Collapsed State */
.pws-sidebar-collapsed .pws-app-wrapper {
    grid-template-columns: 60px 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
}

.pws-sidebar-collapsed .pws-app-sidebar {
    width: 60px;
    min-width: 60px;
    grid-row: 2;
    height: calc(100vh - var(--pws-header-height));
}

.pws-sidebar-collapsed .pws-app-header {
    grid-column: 1 / -1;
    padding-left: 12px;
    padding-inline-start: 12px;
}

.pws-sidebar-collapsed .pws-sidebar-logo {
    display: none;
}

.pws-sidebar-collapsed .pws-sidebar-logo-img {
    max-width: 40px;
    height: auto;
    margin: 0 auto;
}

.pws-sidebar-collapsed .pws-sidebar-logo-text {
    font-size: 11px;
    text-overflow: clip;
    overflow: hidden;
    max-width: 44px;
    margin: 0 auto;
    text-align: center;
}

.pws-sidebar-collapsed .pws-nav-label {
    display: none;
}

.pws-sidebar-collapsed .pws-nav-item {
    justify-content: center;
    padding: 10px;
    border-left: none;
    border-inline-start: none;
}

.pws-sidebar-collapsed .pws-nav-item.active {
    background: var(--pws-primary-light);
    border-radius: 4px;
    margin: 2px 6px;
}

.pws-sidebar-collapsed .pws-nav-section {
    border-bottom: none;
}

.pws-sidebar-collapsed .pws-sidebar-footer {
    display: none;
}

/* Icon-Only Sidebar (permanent) */
.pws-sidebar-icon-only .pws-app-wrapper {
    grid-template-columns: 60px 1fr;
}

.pws-sidebar-icon-only .pws-sidebar-logo {
    padding: 8px;
    text-align: center;
    overflow: hidden;
}

.pws-sidebar-icon-only .pws-sidebar-logo-img {
    max-width: 40px;
    height: auto;
    margin: 0 auto;
}

.pws-sidebar-icon-only .pws-sidebar-logo-text {
    font-size: 11px;
    text-overflow: clip;
    overflow: hidden;
    max-width: 44px;
    margin: 0 auto;
    text-align: center;
}

.pws-sidebar-icon-only .pws-nav-label {
    display: none;
}

.pws-sidebar-icon-only .pws-nav-item {
    justify-content: center;
    padding: 10px;
    border-left: none;
    border-inline-start: none;
}

.pws-sidebar-icon-only .pws-nav-item.active {
    background: var(--pws-primary-light);
    border-radius: 4px;
    margin: 2px 6px;
}

.pws-sidebar-icon-only .pws-nav-section {
    border-bottom: none;
}

.pws-sidebar-icon-only .pws-sidebar-footer {
    display: none;
}

/* Flat UI (no border-radius) */
.pws-flat-ui .pws-app-card,
.pws-flat-ui .pws-login-box,
.pws-flat-ui .pws-btn,
.pws-flat-ui input,
.pws-flat-ui select,
.pws-flat-ui textarea,
.pws-flat-ui .pws-status-badge {
    border-radius: 0 !important;
}

/* Main Content */
.pws-app-main {
    grid-area: main;
    padding: 25px;
    overflow-y: auto;
    max-width: var(--pws-content-width);
    font-family: var(--pws-font-content);
}

.pws-content-header {
    margin-bottom: 25px;
}

.pws-content-header h1 {
    margin: 0;
    font-size: var(--pws-font-h1);
    font-weight: var(--pws-weight-h1);
    font-family: var(--pws-font-heading);
}

/* =====================================================
   COMPONENTS: CARDS
   ===================================================== */
.pws-app-card {
    background: var(--pws-white);
    border: 1px solid var(--pws-border);
    border-radius: 8px;
    overflow: hidden;
}

.pws-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--pws-border);
}

.pws-card-header h3,
.pws-card-header h4 {
    margin: 0;
    font-size: var(--pws-font-h4);
    font-weight: var(--pws-weight-h3);
    font-family: var(--pws-font-heading);
}

.pws-card-body {
    padding: 20px;
}

.pws-app-card-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* =====================================================
   COMPONENTS: KPIs
   ===================================================== */
.pws-app-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.pws-app-kpis-sm {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 20px;
}

.pws-kpi-card {
    background: var(--pws-white);
    border: 1px solid var(--pws-border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.pws-app-kpis-sm .pws-kpi-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
    gap: 5px;
}

.pws-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pws-kpi-icon .dashicons {
    font-size: 24px;
}

.pws-kpi-content {
    display: flex;
    flex-direction: column;
}

.pws-kpi-value {
    font-size: var(--pws-font-h1);
    font-weight: var(--pws-weight-h1);
    font-family: var(--pws-font-heading);
    color: var(--pws-text);
}

.pws-app-kpis-sm .pws-kpi-value {
    font-size: var(--pws-font-h2);
}

.pws-kpi-label {
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* =====================================================
   COMPONENTS: TABLES
   ===================================================== */
.pws-app-table {
    width: 100%;
    border-collapse: collapse;
}

.pws-app-table th {
    text-align: left;
    text-align: start;
    padding: 12px 15px;
    font-size: var(--pws-font-table-head);
    font-weight: var(--pws-weight-table-head);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--pws-text-muted);
    background: var(--pws-bg);
    border-bottom: 2px solid var(--pws-border);
}

.pws-app-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--pws-border);
    vertical-align: middle;
}

.pws-app-table tbody tr:hover {
    background: #fafafa;
}

.pws-app-table .text-right {
    text-align: right;
    text-align: end;
}

/* ── Directional text-alignment utilities (v2.7.0) ── */
.align-end {
    text-align: right;
    text-align: end;
}
.align-start {
    text-align: left;
    text-align: start;
}

.pws-amount {
    font-weight: var(--pws-weight-h2);
    white-space: nowrap;
}

.pws-amount-lg {
    font-size: var(--pws-font-h2);
    font-weight: var(--pws-weight-h2);
    color: var(--pws-primary);
}

/* =====================================================
   COMPONENTS: STATUS BADGES
   ===================================================== */
.pws-status {
    display: inline-block;
    padding: 4px 10px;
    font-size: var(--pws-font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
}

.pws-status-sm {
    padding: 2px 6px;
    font-size: var(--pws-font-xs);
}

.pws-status-lg {
    padding: 8px 16px;
    font-size: var(--pws-font-table);
}

.pws-status-draft { background: #e9ecef; color: #495057; }
.pws-status-sent { background: #fff3cd; color: #856404; }
.pws-status-paid { background: #d4edda; color: #155724; }
.pws-status-overdue { background: #f8d7da; color: #721c24; }
.pws-status-cancelled { background: #e9ecef; color: #6c757d; }
.pws-status-completed { background: #d4edda; color: #155724; }
.pws-status-pending { background: #fff3cd; color: #856404; }
.pws-status-voided { background: #e9ecef; color: #6c757d; text-decoration: line-through; }
.pws-status-lead { background: #cce5ff; color: #004085; }
.pws-status-client { background: #d4edda; color: #155724; }
.pws-status-inactive { background: #e9ecef; color: #6c757d; }

/* =====================================================
   COMPONENTS: BUTTONS
   ===================================================== */
.pws-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: var(--pws-font-button);
    font-weight: var(--pws-weight-button);
    font-family: var(--pws-font-btn);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.pws-btn-sm {
    padding: 6px 12px;
    font-size: var(--pws-font-small);
}

.pws-btn-primary {
    background: var(--pws-primary);
    color: var(--pws-white);
    border-color: var(--pws-primary);
}

.pws-btn-primary:hover {
    background: var(--pws-primary-dark);
    border-color: var(--pws-primary-dark);
    text-decoration: none;
    color: var(--pws-white);
}

.pws-btn-outline {
    background: transparent;
    color: var(--pws-primary);
    border-color: var(--pws-primary);
}

.pws-btn-outline:hover {
    background: var(--pws-primary);
    color: var(--pws-white);
    text-decoration: none;
}

/* =====================================================
   COMPONENTS: FILTERS
   ===================================================== */
.pws-app-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.pws-filter {
    display: inline-block;
    padding: 6px 14px;
    font-size: var(--pws-font-table);
    color: var(--pws-text-muted);
    background: var(--pws-white);
    border: 1px solid var(--pws-border);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s;
}

.pws-filter:hover {
    background: var(--pws-bg);
    color: var(--pws-text);
    text-decoration: none;
}

.pws-filter.active {
    background: var(--pws-primary);
    color: var(--pws-white);
    border-color: var(--pws-primary);
}

/* =====================================================
   COMPONENTS: ACTIONS BAR
   ===================================================== */
.pws-app-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* =====================================================
   COMPONENTS: GRID LAYOUTS
   ===================================================== */
.pws-app-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.pws-app-grid-sidebar {
    grid-template-columns: 1fr 350px;
}

/* =====================================================
   COMPONENTS: LISTS
   ===================================================== */
.pws-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pws-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--pws-border);
}

.pws-list li:last-child {
    border-bottom: none;
}

.pws-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pws-timeline-item {
    padding: 10px 0 10px 20px;
    border-left: 2px solid var(--pws-border);
    border-inline-start: 2px solid var(--pws-border);
    position: relative;
}

.pws-timeline-item::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--pws-primary);
    border-radius: 50%;
    position: absolute;
    left: -5px;
    inset-inline-start: -5px;
    top: 14px;
}

.pws-timeline-date {
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
}

.pws-timeline-type {
    display: inline-block;
    font-size: var(--pws-font-xs);
    padding: 2px 6px;
    background: var(--pws-bg);
    border-radius: 3px;
    margin-left: 8px;
    margin-inline-start: 8px;
    text-transform: uppercase;
}

.pws-timeline-item p {
    margin: 5px 0 0 0;
    font-size: var(--pws-font-table);
}

/* =====================================================
   COMPONENTS: DEFINITION LISTS
   ===================================================== */
.pws-dl {
    margin: 0;
}

.pws-dl dt {
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 12px;
}

.pws-dl dt:first-child {
    margin-top: 0;
}

.pws-dl dd {
    margin: 4px 0 0 0;
    font-size: var(--pws-font-base);
}

.pws-dl-compact dt {
    margin-top: 8px;
}

/* =====================================================
   COMPONENTS: TASK LIST
   ===================================================== */
.pws-task-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pws-task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--pws-border);
}

.pws-task-item:last-child {
    border-bottom: none;
}

.pws-task-check {
    color: var(--pws-text-muted);
}

.pws-task-done .pws-task-check {
    color: var(--pws-success);
}

.pws-task-content {
    flex: 1;
}

.pws-task-due {
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
    margin-left: 8px;
    margin-inline-start: 8px;
}

/* =====================================================
   COMPONENTS: NOTES
   ===================================================== */
.pws-notes {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--pws-border);
}

.pws-notes strong {
    font-size: var(--pws-font-xs);
    text-transform: uppercase;
    color: var(--pws-text-muted);
}

.pws-notes p {
    margin: 8px 0 0 0;
}

/* =====================================================
   COMPONENTS: NOTICES
   ===================================================== */
.pws-app-notice {
    padding: 15px 20px;
    border-radius: 6px;
    background: var(--pws-bg);
    border: 1px solid var(--pws-border);
}

.pws-app-notice p {
    margin: 0;
}

.pws-app-notice-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.pws-app-notice-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.pws-empty {
    color: var(--pws-text-muted);
    font-style: italic;
}

/* =====================================================
   COMPONENTS: INVOICE PREVIEW
   ===================================================== */
.pws-invoice-preview {
    padding: 30px;
}

.pws-invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--pws-border);
}

.pws-invoice-logo {
    max-height: 40px;
}

.pws-invoice-number {
    font-size: var(--pws-font-h2);
    font-weight: var(--pws-weight-h2);
    font-family: var(--pws-font-heading);
}

.pws-invoice-date {
    color: var(--pws-text-muted);
}

.pws-invoice-parties {
    margin-bottom: 25px;
}

.pws-invoice-party strong {
    font-size: var(--pws-font-xs);
    text-transform: uppercase;
    color: var(--pws-text-muted);
}

.pws-invoice-party p {
    margin: 8px 0 0 0;
}

.pws-invoice-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.pws-invoice-items th {
    text-align: left;
    text-align: start;
    padding: 10px;
    font-size: var(--pws-font-table-head);
    text-transform: uppercase;
    background: var(--pws-bg);
    border-bottom: 2px solid var(--pws-border);
}

.pws-invoice-items td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--pws-border);
}

.pws-invoice-items tfoot td {
    padding: 8px 10px;
    border-bottom: none;
}

.pws-invoice-total td {
    font-size: var(--pws-font-h3);
    border-top: 2px solid var(--pws-text);
}

/* Invoice Form Totals Summary */
.pws-invoice-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--pws-border, #e0e0e0);
}
.pws-totals-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    min-width: 200px;
    padding: 5px 0;
    font-size: 13px;
    color: var(--pws-text, #1d2327);
}
.pws-totals-row > span:first-child {
    font-weight: 500;
}
.pws-totals-row > span:last-child {
    text-align: right;
    text-align: end;
    font-variant-numeric: tabular-nums;
}
.pws-totals-grand {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 2px solid var(--pws-text, #1d2327);
    font-size: 15px;
    font-weight: 700;
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */
.pws-text-success { color: var(--pws-success); }
.pws-text-danger { color: var(--pws-danger); }
.pws-text-warning { color: var(--pws-warning); }
.pws-text-muted { color: var(--pws-text-muted); }

.pws-voided {
    opacity: 0.5;
}

.pws-voided td {
    text-decoration: line-through;
}

.pws-link {
    font-size: var(--pws-font-table);
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
body.pws-erp-login {
    background: linear-gradient(135deg, var(--pws-primary) 0%, var(--pws-primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pws-login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.pws-login-box {
    background: var(--pws-white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.pws-login-header {
    text-align: center;
    margin-bottom: 30px;
}

.pws-login-logo {
    max-height: 50px;
    margin-bottom: 10px;
}

.pws-login-title {
    margin: 0;
    font-size: var(--pws-font-h1);
    font-family: var(--pws-font-heading);
    color: var(--pws-primary);
}

.pws-login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: var(--pws-font-table);
}

.pws-login-form .pws-form-group {
    margin-bottom: 20px;
}

.pws-login-form label {
    display: block;
    font-size: var(--pws-font-table);
    font-weight: var(--pws-weight-input);
    margin-bottom: 6px;
    color: var(--pws-text);
}

.pws-login-form input[type="text"],
.pws-login-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    font-size: var(--pws-font-input);
    border: 1px solid var(--pws-border);
    border-radius: 6px;
    transition: border-color 0.2s;
}

.pws-login-form input:focus {
    outline: none;
    border-color: var(--pws-primary);
}

.pws-form-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
}

.pws-login-btn {
    width: 100%;
    padding: 14px;
    font-size: var(--pws-font-h4);
    font-weight: var(--pws-weight-button);
    font-family: var(--pws-font-btn);
    background: var(--pws-primary);
    color: var(--pws-white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.pws-login-btn:hover {
    background: var(--pws-primary-dark);
}

.pws-login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--pws-border);
}

.pws-login-footer a {
    font-size: var(--pws-font-table);
    color: var(--pws-text-muted);
}

/* Inline Password Reset */
.pws-reset-description {
    font-size: var(--pws-font-table);
    color: var(--pws-text-muted);
    margin: 0 0 20px;
    line-height: 1.5;
}

.pws-reset-success {
    background: #d4edda;
    color: #155724;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: var(--pws-font-table);
}

.pws-reset-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: var(--pws-font-table);
}

.pws-login-form input[type="email"] {
    width: 100%;
    padding: 12px 15px;
    font-size: var(--pws-font-input);
    border: 1px solid var(--pws-border);
    border-radius: 6px;
    transition: border-color 0.2s;
}

.pws-login-form input[type="email"]:focus {
    outline: none;
    border-color: var(--pws-primary);
}

/* =====================================================
   ERROR PAGES
   ===================================================== */
body.pws-erp-error {
    background: var(--pws-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pws-error-wrapper {
    text-align: center;
    padding: 20px;
}

.pws-error-box {
    background: var(--pws-white);
    border-radius: 12px;
    padding: 50px;
    max-width: 500px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pws-error-code {
    font-size: 80px;
    font-weight: var(--pws-weight-h1);
    font-family: var(--pws-font-heading);
    color: var(--pws-primary);
    line-height: 1;
    margin-bottom: 10px;
}

.pws-error-box h1 {
    margin: 0 0 15px 0;
    font-size: var(--pws-font-h1);
    font-family: var(--pws-font-heading);
}

.pws-error-box p {
    color: var(--pws-text-muted);
    margin-bottom: 25px;
}

.pws-error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* =====================================================
   MOBILE OVERLAY
   ===================================================== */
.pws-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    inset-inline-start: 0;
    right: 0;
    inset-inline-end: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .pws-app-grid {
        grid-template-columns: 1fr;
    }
    
    .pws-app-grid-sidebar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .pws-app-wrapper,
    .pws-sidebar-icon-only .pws-app-wrapper,
    .pws-sidebar-collapsed .pws-app-wrapper {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    .pws-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
        -webkit-tap-highlight-color: transparent;
    }

    .pws-mobile-toggle .dashicons {
        font-size: 24px;
        width: 24px;
        height: 24px;
    }

    .pws-sidebar-collapse-btn {
        display: none !important;
    }

    .pws-app-sidebar,
    .pws-sidebar-icon-only .pws-app-sidebar,
    .pws-sidebar-collapsed .pws-app-sidebar {
        position: fixed;
        top: var(--pws-header-height);
        left: -100%;
        inset-inline-start: -100%;
        width: var(--pws-sidebar-width);
        min-width: var(--pws-sidebar-width);
        height: calc(100vh - var(--pws-header-height));
        height: calc(100dvh - var(--pws-header-height));
        max-height: calc(100vh - var(--pws-header-height));
        max-height: calc(100dvh - var(--pws-header-height));
        z-index: 95;
        grid-area: auto;
        grid-row: auto;
        transition: left 0.3s ease;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .pws-app-sidebar.open {
        left: 0;
        inset-inline-start: 0;
    }

    /* Show full logo on mobile even in icon-only/collapsed mode */
    .pws-sidebar-icon-only .pws-sidebar-logo,
    .pws-sidebar-collapsed .pws-sidebar-logo {
        display: block;
        padding: var(--pws-logo-padding-top, 12px) var(--pws-logo-padding-right, 16px) var(--pws-logo-padding-bottom, 12px) var(--pws-logo-padding-left, 16px);
        text-align: left;
        text-align: start;
    }

    .pws-sidebar-icon-only .pws-sidebar-logo-img,
    .pws-sidebar-collapsed .pws-sidebar-logo-img {
        max-width: var(--pws-logo-width, 260px);
        margin: 0;
    }

    .pws-sidebar-icon-only .pws-sidebar-logo-text,
    .pws-sidebar-collapsed .pws-sidebar-logo-text {
        font-size: 16px;
        max-width: none;
        text-align: left;
        text-align: start;
    }

    /* Show labels on mobile even in icon-only/collapsed mode */
    .pws-sidebar-icon-only .pws-nav-label,
    .pws-sidebar-collapsed .pws-nav-label {
        display: inline;
    }

    .pws-sidebar-icon-only .pws-nav-item,
    .pws-sidebar-collapsed .pws-nav-item {
        justify-content: flex-start;
        padding: 9px 16px;
        border-left: 3px solid transparent;
        border-inline-start: 3px solid transparent;
        border-radius: 0;
        margin: 0;
    }

    .pws-sidebar-icon-only .pws-nav-item.active,
    .pws-sidebar-collapsed .pws-nav-item.active {
        border-radius: 0;
        margin: 0;
        border-left-color: var(--pws-sidebar-active-accent, var(--pws-primary));
        border-inline-start-color: var(--pws-sidebar-active-accent, var(--pws-primary));
    }

    .pws-sidebar-icon-only .pws-nav-section,
    .pws-sidebar-collapsed .pws-nav-section {
        border-bottom: 1px solid var(--pws-nav-section-border, var(--pws-border, rgba(0,0,0,0.06)));
    }

    .pws-sidebar-icon-only .pws-sidebar-footer,
    .pws-sidebar-collapsed .pws-sidebar-footer {
        display: block;
    }

    /* On mobile: reset collapsed/icon-only flyouts to normal expand/collapse */
    .pws-sidebar-icon-only .pws-nav-chevron,
    .pws-sidebar-collapsed .pws-nav-chevron {
        display: block;
    }

    .pws-sidebar-icon-only .pws-nav-group-header,
    .pws-sidebar-collapsed .pws-nav-group-header {
        justify-content: flex-start;
        padding: 10px 16px 10px 19px;
        padding-inline: 19px 16px;
    }

    .pws-sidebar-icon-only .pws-nav-group-items,
    .pws-sidebar-collapsed .pws-nav-group-items,
    .pws-sidebar-icon-only .pws-nav-group[open] > .pws-nav-group-items,
    .pws-sidebar-collapsed .pws-nav-group[open] > .pws-nav-group-items,
    .pws-sidebar-icon-only .pws-nav-group:hover > .pws-nav-group-items,
    .pws-sidebar-collapsed .pws-nav-group:hover > .pws-nav-group-items {
        position: static;
        border: none;
        box-shadow: none;
        min-width: auto;
        padding: 0 0 4px 0;
        border-radius: 0;
    }

    /* Hide by default, show only when open (not on hover) */
    .pws-sidebar-icon-only .pws-nav-group-items,
    .pws-sidebar-collapsed .pws-nav-group-items {
        display: none;
    }

    .pws-sidebar-icon-only .pws-nav-group[open] > .pws-nav-group-items,
    .pws-sidebar-collapsed .pws-nav-group[open] > .pws-nav-group-items {
        display: block;
    }

    .pws-sidebar-icon-only .pws-nav-group-items .pws-nav-item-child,
    .pws-sidebar-collapsed .pws-nav-group-items .pws-nav-item-child {
        padding-left: 49px;
        padding-inline-start: 49px;
        border-left: 3px solid transparent;
        border-inline-start: 3px solid transparent;
    }

    .pws-sidebar-icon-only .pws-nav-group-items .pws-nav-item-child::before,
    .pws-sidebar-collapsed .pws-nav-group-items .pws-nav-item-child::before {
        display: block;
    }

    .pws-mobile-overlay.active {
        display: block;
    }

    /* Touch-friendly nav items */
    /* Touch targets: ensure at least 44px but respect settings if larger */
    .pws-nav-item {
        min-height: max(44px, var(--pws-nav-header-height, 42px));
    }

    .pws-nav-item-child {
        min-height: max(44px, var(--pws-nav-submenu-height, 36px));
    }

    .pws-nav-group-header {
        min-height: max(44px, var(--pws-nav-header-height, 42px));
    }

    /* Body scroll lock when sidebar is open */
    body.pws-erp-app.pws-mobile-nav-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    .pws-app-main {
        padding: 15px;
    }
    
    .pws-content-header h1 {
        font-size: 20px;
    }
    
    .pws-app-kpis {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pws-kpi-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .pws-kpi-icon {
        width: 36px;
        height: 36px;
    }
    
    .pws-kpi-icon .dashicons {
        font-size: 18px;
    }
    
    .pws-kpi-value {
        font-size: 20px;
    }
    
    .pws-app-table {
        font-size: 12px;
    }
    
    .pws-app-table th,
    .pws-app-table td {
        padding: 8px 10px;
    }
    
    .pws-app-actions {
        flex-wrap: wrap;
    }
    
    .pws-app-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 5px;
    }
    
    .pws-filter {
        white-space: nowrap;
    }
}

/* =====================================================
   CRM MODULE STYLES (Phase C)
   ===================================================== */

/* CRM Sub-navigation */
.pws-crm-subnav {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--pws-bg);
    border-radius: 8px;
    width: fit-content;
}

.pws-crm-subnav a {
    padding: 8px 16px;
    border-radius: 6px;
    color: var(--pws-text);
    text-decoration: none;
    font-size: var(--pws-font-table);
    font-weight: var(--pws-weight-button);
    transition: all 0.15s ease;
}

.pws-crm-subnav a:hover {
    background: var(--pws-white);
}

.pws-crm-subnav a.active {
    background: var(--pws-white);
    color: var(--pws-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* CRM Stats Grid */
.pws-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.pws-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--pws-white);
    border-radius: 12px;
    box-shadow: var(--pws-shadow);
}

.pws-stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pws-primary-light);
    color: var(--pws-primary);
    border-radius: 12px;
}

.pws-stat-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.pws-stat-value {
    font-size: var(--pws-font-h1);
    font-weight: var(--pws-weight-h1);
    font-family: var(--pws-font-heading);
    line-height: 1;
    color: var(--pws-text);
}

.pws-stat-label {
    font-size: var(--pws-font-small);
    font-weight: var(--pws-weight-small);
    color: var(--pws-text-muted);
    margin-top: 4px;
}

.pws-stat-success .pws-stat-icon {
    background: #e8f5e9;
    color: #27ae60;
}

/* CRM Columns Layout */
.pws-crm-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

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

/* Pipeline Board */
.pws-pipeline-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 500px;
}

.pws-pipeline-column {
    flex: 0 0 280px;
    background: var(--pws-bg);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 250px);
}

.pws-pipeline-header {
    padding: 16px;
    border-bottom: 3px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pws-pipeline-header h4 {
    margin: 0;
    font-size: var(--pws-font-base);
    font-family: var(--pws-font-heading);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pws-stage-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.pws-stage-count {
    background: var(--pws-white);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: var(--pws-font-small);
    font-weight: var(--pws-weight-table-head);
}

.pws-pipeline-cards {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-height: 100px;
}

.pws-pipeline-cards.drag-over {
    background: rgba(10, 110, 124, 0.05);
}

.pws-pipeline-card {
    background: var(--pws-white);
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.1s;
}

.pws-pipeline-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.pws-pipeline-card.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}

.pws-pipeline-card .pws-card-name a {
    font-weight: var(--pws-weight-h4);
    color: var(--pws-text);
    text-decoration: none;
}

.pws-pipeline-card .pws-card-name a:hover {
    color: var(--pws-primary);
}

.pws-pipeline-card .pws-card-contact {
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
    margin-top: 4px;
}

.pws-pipeline-card .pws-card-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
}

.pws-pipeline-card .pws-card-followup {
    margin-top: 10px;
    padding: 6px 10px;
    background: #fff3e0;
    border-radius: 6px;
    font-size: var(--pws-font-xs);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pws-pipeline-card .pws-card-followup.pws-overdue {
    background: #ffebee;
    color: #c62828;
}

.pws-pipeline-empty {
    text-align: center;
    padding: 30px;
    color: var(--pws-text-muted);
    font-size: var(--pws-font-table);
}

/* Follow-up List */
.pws-followup-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pws-followup-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--pws-border);
}

.pws-followup-item:last-child {
    border-bottom: none;
}

.pws-followup-date {
    flex: 0 0 70px;
    font-size: var(--pws-font-small);
    font-weight: var(--pws-weight-table-head);
    color: var(--pws-text-muted);
}

.pws-followup-overdue .pws-followup-date {
    color: #c62828;
}

.pws-followup-content {
    flex: 1;
    min-width: 0;
}

.pws-followup-content strong {
    display: block;
    font-size: var(--pws-font-table);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pws-followup-client {
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
}

.pws-followup-client a {
    color: var(--pws-text-muted);
}

/* Activity List */
.pws-activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pws-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--pws-border);
}

.pws-activity-item:last-child {
    border-bottom: none;
}

.pws-activity-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pws-bg);
    border-radius: 8px;
    color: var(--pws-text-muted);
}

.pws-activity-content {
    flex: 1;
    min-width: 0;
}

.pws-activity-title {
    display: block;
    font-size: var(--pws-font-table);
    font-weight: var(--pws-weight-button);
}

.pws-activity-meta {
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
}

.pws-activity-meta a {
    color: var(--pws-text-muted);
}

.pws-activity-time {
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
    white-space: nowrap;
}

/* Search Box */
.pws-search-box {
    margin-bottom: 24px;
}

.pws-search-box form {
    display: flex;
    gap: 12px;
}

.pws-search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.pws-search-input-wrap .dashicons {
    position: absolute;
    left: 16px;
    inset-inline-start: 16px;
    color: var(--pws-text-muted);
}

.pws-search-input-wrap input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--pws-border);
    border-radius: 10px;
    font-size: var(--pws-font-h4);
}

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

.pws-search-clear {
    position: absolute;
    right: 16px;
    inset-inline-end: 16px;
    color: var(--pws-text-muted);
    text-decoration: none;
    font-size: var(--pws-font-h2);
}

.pws-search-count {
    color: var(--pws-text-muted);
    font-size: var(--pws-font-base);
    margin-bottom: 16px;
}

.pws-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pws-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--pws-white);
    border-radius: 10px;
    text-decoration: none;
    color: var(--pws-text);
    transition: box-shadow 0.15s;
}

.pws-result-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pws-result-type {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--pws-bg);
}

.pws-result-type-client { background: #e3f2fd; color: #1976d2; }
.pws-result-type-communication { background: #f3e5f5; color: #7b1fa2; }
.pws-result-type-note { background: #fff3e0; color: #f57c00; }

.pws-result-content {
    flex: 1;
    min-width: 0;
}

.pws-result-content strong {
    display: block;
    margin-bottom: 2px;
}

.pws-result-subtitle,
.pws-result-preview {
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
    display: block;
}

.pws-search-hints {
    background: var(--pws-bg);
    padding: 24px;
    border-radius: 10px;
}

.pws-search-hints h4 {
    margin: 0 0 12px 0;
    font-family: var(--pws-font-heading);
}

.pws-search-hints ul {
    margin: 0;
    padding-left: 20px;
    padding-inline-start: 20px;
    color: var(--pws-text-muted);
}

/* Filter Tabs */
.pws-filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pws-filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--pws-bg);
    padding: 4px;
    border-radius: 8px;
}

.pws-filter-tab {
    padding: 8px 16px;
    border-radius: 6px;
    color: var(--pws-text);
    text-decoration: none;
    font-size: var(--pws-font-table);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pws-filter-tab:hover {
    background: var(--pws-white);
}

.pws-filter-tab.active {
    background: var(--pws-white);
    font-weight: var(--pws-weight-table-head);
}

.pws-filter-tab .pws-count {
    background: var(--pws-primary-light);
    color: var(--pws-primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: var(--pws-font-xs);
}

.pws-filter-danger.active .pws-count,
.pws-filter-danger:hover .pws-count {
    background: #ffebee;
    color: #c62828;
}

/* Table Row States */
.pws-row-danger {
    background: #fff5f5;
}

.pws-row-warning {
    background: #fffbf0;
}

/* Client Timeline Page */
.pws-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.pws-timeline-client h2 {
    margin: 0 0 4px 0;
    font-family: var(--pws-font-heading);
}

.pws-timeline-actions {
    display: flex;
    gap: 8px;
}

.pws-timeline-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .pws-timeline-content {
        grid-template-columns: 1fr;
    }
}

.pws-timeline-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pws-sidebar-section {
    background: var(--pws-white);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--pws-shadow);
}

.pws-sidebar-section h4 {
    margin: 0 0 12px 0;
    font-size: var(--pws-font-table);
    font-family: var(--pws-font-heading);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pws-pinned-note {
    padding: 10px 0;
    border-bottom: 1px solid var(--pws-border);
}

.pws-pinned-note:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pws-pinned-note p {
    margin: 0;
    font-size: var(--pws-font-table);
}

.pws-pinned-note small {
    color: var(--pws-text-muted);
    font-size: var(--pws-font-xs);
}

.pws-quick-info dt {
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
    margin-top: 8px;
}

.pws-quick-info dt:first-child {
    margin-top: 0;
}

.pws-quick-info dd {
    margin: 2px 0 0 0;
    font-size: var(--pws-font-table);
}

/* Full Timeline */
.pws-timeline-main {
    background: var(--pws-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--pws-shadow);
}

.pws-timeline-date-header {
    font-size: var(--pws-font-small);
    font-weight: var(--pws-weight-table-head);
    color: var(--pws-text-muted);
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--pws-border);
}

.pws-timeline .pws-timeline-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-left: none;
    border-inline-start: none;
}

.pws-timeline .pws-timeline-item::before {
    display: none;
}

.pws-timeline .pws-timeline-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pws-bg);
    border-radius: 10px;
    flex-shrink: 0;
}

.pws-timeline .pws-timeline-communication .pws-timeline-icon { background: #e3f2fd; color: #1976d2; }
.pws-timeline .pws-timeline-note .pws-timeline-icon { background: #fff3e0; color: #f57c00; }
.pws-timeline .pws-timeline-followup .pws-timeline-icon { background: #e8f5e9; color: #27ae60; }
.pws-timeline .pws-timeline-audit .pws-timeline-icon { background: #fce4ec; color: #c2185b; }

.pws-timeline-card {
    flex: 1;
    min-width: 0;
}

.pws-timeline-card .pws-timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.pws-timeline-card .pws-timeline-header strong {
    flex: 1;
}

.pws-timeline-time {
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
}

.pws-timeline-body {
    font-size: var(--pws-font-table);
    color: var(--pws-text);
    line-height: 1.5;
    white-space: pre-wrap;
}

.pws-timeline-changes {
    margin-top: 8px;
}

.pws-timeline-changes .pws-change {
    display: inline-block;
    font-size: var(--pws-font-small);
    background: var(--pws-bg);
    padding: 4px 8px;
    border-radius: 4px;
    margin-right: 8px;
    margin-inline-end: 8px;
    margin-bottom: 4px;
}

.pws-timeline-changes del {
    color: #c62828;
    text-decoration: line-through;
}

.pws-timeline-changes ins {
    color: #2e7d32;
    text-decoration: none;
    font-weight: var(--pws-weight-table-head);
}

.pws-timeline-attachments {
    margin-top: 10px;
}

.pws-timeline-attachments .pws-attachment {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--pws-bg);
    border-radius: 6px;
    font-size: var(--pws-font-small);
    color: var(--pws-text);
    text-decoration: none;
    margin-right: 8px;
    margin-inline-end: 8px;
}

.pws-timeline-footer {
    margin-top: 8px;
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
}

.pws-pinned-icon {
    color: #f57c00;
    font-size: var(--pws-font-base) !important;
}

/* Modal improvements for CRM */
.pws-modal {
    position: fixed;
    top: 0;
    left: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.pws-modal-content {
    background: var(--pws-white);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.pws-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pws-border);
}

.pws-modal-header h3 {
    margin: 0;
    font-family: var(--pws-font-heading);
}

.pws-modal-close {
    background: none;
    border: none;
    font-size: var(--pws-font-h1);
    color: var(--pws-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.pws-modal form {
    padding: 20px;
}

.pws-form-row {
    margin-bottom: 16px;
}

.pws-form-row label {
    display: block;
    font-weight: var(--pws-weight-input);
    font-size: var(--pws-font-table);
    margin-bottom: 6px;
}

.pws-form-row input[type="text"],
.pws-form-row input[type="date"],
.pws-form-row input[type="datetime-local"],
.pws-form-row textarea,
.pws-form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--pws-border);
    border-radius: 8px;
    font-size: var(--pws-font-input);
}

.pws-form-row input:focus,
.pws-form-row textarea:focus,
.pws-form-row select:focus {
    border-color: var(--pws-primary);
    outline: none;
}

.pws-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--pws-border);
    margin-top: 10px;
}

/* =====================================================
   UX POLISH: Form States
   ===================================================== */
.pws-btn:disabled,
.pws-btn.pws-btn-loading {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

.pws-btn-loading {
    position: relative;
}

.pws-btn-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: pws-spin 0.6s linear infinite;
    margin-left: 8px;
    margin-inline-start: 8px;
}

@keyframes pws-spin {
    to { transform: rotate(360deg); }
}

.pws-form input:invalid:not(:placeholder-shown),
.pws-form select:invalid:not(:placeholder-shown) {
    border-color: var(--pws-danger);
}

.pws-form input:focus,
.pws-form select:focus,
.pws-form textarea:focus {
    border-color: var(--pws-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(10, 110, 124, 0.1);
}

/* =====================================================
   UX POLISH: Success Notice
   ===================================================== */
.pws-app-notice-success,
.pws-notice-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    margin-bottom: 20px;
}

/* Legacy notice classes for consistency */
.pws-notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    background: var(--pws-bg);
    border: 1px solid var(--pws-border);
}

.pws-notice-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* =====================================================
   UX POLISH: Empty States
   ===================================================== */
.pws-app-empty,
.pws-empty-state {
    text-align: center;
    padding: 60px 30px;
    background: var(--pws-white);
    border: 1px solid var(--pws-border);
    border-radius: 8px;
}

.pws-empty-icon,
.pws-empty-state .dashicons {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
    color: var(--pws-text-muted);
}

.pws-empty-state .dashicons {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
}

.pws-app-empty h3,
.pws-empty-state p:first-of-type {
    margin: 0 0 8px 0;
    font-size: var(--pws-font-h3);
    color: var(--pws-text);
}

.pws-app-empty p,
.pws-empty-state p {
    margin: 0 0 20px 0;
    color: var(--pws-text-muted);
    font-size: var(--pws-font-base);
}

/* =====================================================
   TABLE HEADER ALIGNMENT
   ===================================================== */
.pws-table th {
    text-align: left;
    text-align: start;
}

/* =====================================================
   UX POLISH: Clickable Table Rows
   ===================================================== */
.pws-app-table tbody tr,
.pws-table tbody tr {
    transition: background 0.15s ease;
}

.pws-app-table tbody tr:hover,
.pws-table tbody tr:hover {
    background: var(--pws-primary-light);
}

.pws-app-table tbody tr.pws-row-clickable,
.pws-table tbody tr.pws-row-clickable {
    cursor: pointer;
}

.pws-app-table tbody tr.pws-row-clickable:hover,
.pws-table tbody tr.pws-row-clickable:hover {
    background: var(--pws-primary-light);
}

.pws-app-table tbody tr.pws-row-voided:hover,
.pws-table tbody tr.pws-row-voided:hover {
    background: #f8f9fa;
}

/* =====================================================
   UX POLISH: Action Column Alignment
   ===================================================== */
.pws-col-actions {
    white-space: nowrap;
    text-align: right;
    text-align: end;
}

.pws-col-actions .pws-btn {
    margin-left: 6px;
    margin-inline-start: 6px;
}

.pws-col-actions .pws-btn:first-child {
    margin-left: 0;
    margin-inline-start: 0;
}

/* =====================================================
   UX POLISH: Danger Button
   ===================================================== */
.pws-btn-danger {
    background: transparent;
    color: var(--pws-danger);
    border-color: var(--pws-danger);
}

.pws-btn-danger:hover {
    background: var(--pws-danger);
    color: var(--pws-white);
    text-decoration: none;
}

/* =====================================================
   UX POLISH: Field Hints
   ===================================================== */
.pws-field-hint {
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
    margin-top: 4px;
}

/* =====================================================
   UX POLISH: Form Sections & Grids
   ===================================================== */
.pws-form-section {
    margin-bottom: 16px;
}

.pws-form-section label {
    display: block;
    font-size: var(--pws-font-table);
    font-weight: var(--pws-weight-input);
    margin-bottom: 6px;
    color: var(--pws-text);
}

.pws-form-section .required {
    color: var(--pws-danger);
}

.pws-form-section input,
.pws-form-section select,
.pws-form-section textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--pws-border);
    border-radius: 6px;
    font-size: var(--pws-font-input);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pws-form-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.pws-form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.pws-form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

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

/* =====================================================
   Quotation / Invoice Form: Two-Column Layout (wide screens)
   ===================================================== */
.pws-quotation-columns,
.pws-invoice-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 1100px) {
    .pws-quotation-columns,
    .pws-invoice-columns {
        grid-template-columns: 1fr 340px;
        gap: 24px;
        align-items: start;
    }
}

.pws-quotation-col-right,
.pws-invoice-col-right {
    position: sticky;
    top: 20px;
}

/* =====================================================
   UX POLISH: Inline Form
   ===================================================== */
.pws-inline-form {
    display: inline-block;
}

/* =====================================================
   UX POLISH: Project Stages
   ===================================================== */
.pws-status-planning { background: #e3f2fd; color: #1565c0; }
.pws-status-in_progress,
.pws-status-active { background: #fff3e0; color: #ef6c00; }
.pws-status-review { background: #f3e5f5; color: #7b1fa2; }
.pws-status-on_hold { background: #fce4ec; color: #c2185b; }

/* Construction Module: Workflow statuses */
.pws-status-submitted { background: #cce5ff; color: #004085; }
.pws-status-approved { background: #d4edda; color: #155724; }
.pws-status-certified { background: #d4edda; color: #155724; }
.pws-status-received { background: #d4edda; color: #155724; }
.pws-status-rejected { background: #f8d7da; color: #721c24; }

/* =====================================================
   UX POLISH: Module Header
   ===================================================== */
.pws-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pws-module-header h1 {
    margin: 0;
    font-size: var(--pws-font-h1);
    font-weight: var(--pws-weight-h1);
    font-family: var(--pws-font-heading);
}

/* =====================================================
   CLIENT STATISTICS
   ===================================================== */
.pws-client-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.pws-client-stats .pws-stat-card {
    background: var(--pws-white);
    border: 1px solid var(--pws-border);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.pws-client-stats .pws-stat-value {
    font-size: var(--pws-font-h2);
    font-weight: var(--pws-weight-h2);
    color: var(--pws-primary);
    display: block;
    margin-bottom: 4px;
}

.pws-client-stats .pws-stat-label {
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pws-client-stats .pws-stat-warning .pws-stat-value {
    color: var(--pws-warning);
}

/* =====================================================
   CRM CUSTOMER INSIGHTS
   ===================================================== */
.pws-crm-insights {
    margin-bottom: 25px;
}

.pws-insights-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.pws-insight-item {
    text-align: center;
    padding: 15px;
}

.pws-insight-wide {
    grid-column: span 3;
    text-align: left;
    text-align: start;
    border-top: 1px solid var(--pws-border);
    padding-top: 20px;
    margin-top: 5px;
}

.pws-insight-value {
    font-size: var(--pws-font-h1);
    font-weight: var(--pws-weight-h1);
    font-family: var(--pws-font-heading);
    color: var(--pws-primary);
    display: block;
    margin-bottom: 5px;
}

.pws-insight-label {
    font-size: var(--pws-font-table);
    color: var(--pws-text-muted);
    font-weight: var(--pws-weight-small);
}

.pws-insight-sub {
    font-size: var(--pws-font-xs);
    color: var(--pws-text-muted);
    margin-top: 3px;
}

.pws-top-clients {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pws-top-clients li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.pws-top-clients li:last-child {
    border-bottom: none;
}

.pws-top-clients a {
    font-weight: var(--pws-weight-button);
}

.pws-tc-revenue {
    font-weight: var(--pws-weight-h2);
    color: var(--pws-success);
}

@media (max-width: 768px) {
    .pws-insights-grid {
        grid-template-columns: 1fr;
    }
    .pws-insight-wide {
        grid-column: span 1;
    }
}

/* =====================================================
   CLIENTS LIST — Refactored Table & Mobile Cards
   ===================================================== */

/* Table fills full width with proportional columns */
.pws-clients-table {
    width: 100%;
    table-layout: fixed;
}

.pws-clients-table th,
.pws-clients-table td {
    padding: 12px 15px;
    font-size: var(--pws-font-table);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pws-clients-table th {
    font-size: var(--pws-font-table-head);
    font-weight: var(--pws-weight-table-head);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--pws-text-muted);
    background: var(--pws-bg);
    border-bottom: 2px solid var(--pws-border);
    white-space: nowrap;
}

.pws-clients-table td {
    border-bottom: 1px solid var(--pws-border);
}

.pws-clients-table tbody tr:hover {
    background: var(--pws-primary-light);
}

/* Column widths — distribute across full page */
.pws-clients-col-name     { width: 22%; }
.pws-clients-col-email    { width: 20%; }
.pws-clients-col-phone    { width: 14%; }
.pws-clients-col-status   { width: 10%; }
.pws-clients-col-stage    { width: 13%; }
.pws-clients-col-assigned { width: 12%; }
.pws-clients-col-actions  { width: 9%; white-space: nowrap; overflow: visible; }

/* Contact person sub-line */
.pws-clients-contact {
    display: block;
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
    font-weight: var(--pws-weight-base);
    margin-top: 2px;
}

/* Pipeline badge (inline) */
.pws-clients-col-stage .pws-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: var(--pws-font-xs);
    font-weight: 600;
    border-radius: 4px;
    letter-spacing: 0.2px;
    line-height: 1.4;
}

/* More (⋮) dropdown container */
.pws-actions-more {
    display: inline-block;
    position: relative;
}

.pws-btn-more {
    background: var(--pws-white);
    border: 1px solid var(--pws-border);
    font-size: 16px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: var(--pws-radius-sm);
    color: var(--pws-text-muted);
    transition: all 0.15s;
}

.pws-btn-more:hover {
    background: var(--pws-bg);
    color: var(--pws-text);
}

.pws-actions-dropdown {
    display: none;
    position: absolute;
    right: 0;
    inset-inline-end: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 160px;
    background: var(--pws-white);
    border: 1px solid var(--pws-border);
    border-radius: var(--pws-radius);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    z-index: 50;
    overflow: hidden;
}

.pws-actions-dropdown a {
    display: block;
    padding: 10px 16px;
    font-size: var(--pws-font-table);
    color: var(--pws-text);
    text-decoration: none;
    transition: background 0.12s;
}

.pws-actions-dropdown a:hover {
    background: var(--pws-bg);
    text-decoration: none;
}

.pws-actions-dropdown a.pws-text-danger {
    color: var(--pws-danger);
}

.pws-actions-dropdown a.pws-text-danger:hover {
    background: #fdf0f0;
}

.pws-actions-more.open .pws-actions-dropdown {
    display: block;
}

/* Mobile cards hidden by default on desktop */
.pws-clients-cards {
    display: none;
}

/* =====================================================
   CLIENTS LIST — Mobile Card Layout (≤768px)
   ===================================================== */
@media (max-width: 768px) {
    /* Hide desktop table, show cards */
    .pws-clients-table-wrap {
        display: none;
    }
    .pws-clients-cards {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .pws-client-card {
        background: var(--pws-white);
        border: 1px solid var(--pws-border);
        border-radius: var(--pws-radius);
        overflow: hidden;
    }

    .pws-client-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 14px 16px;
        border-bottom: 1px solid var(--pws-border);
        gap: 10px;
    }

    .pws-client-card-name {
        flex: 1;
        min-width: 0;
    }

    .pws-client-card-name strong {
        display: block;
        font-size: var(--pws-font-base);
    }

    .pws-client-card-name strong a {
        color: var(--pws-text);
    }

    .pws-client-card-body {
        padding: 12px 16px;
    }

    .pws-client-card-field {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        font-size: var(--pws-font-table);
    }

    .pws-client-card-field + .pws-client-card-field {
        border-top: 1px solid #f5f5f5;
    }

    .pws-client-card-label {
        font-size: var(--pws-font-xs);
        font-weight: var(--pws-weight-table-head);
        color: var(--pws-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
        margin-right: 12px;
        margin-inline-end: 12px;
    }

    .pws-client-card-actions {
        display: flex;
        gap: 8px;
        padding: 12px 16px;
        border-top: 1px solid var(--pws-border);
        background: var(--pws-bg);
    }

    .pws-client-card-actions .pws-btn {
        flex: 1;
        justify-content: center;
        text-align: center;
        min-height: 44px;
    }
}

/* =====================================================
   FRONTEND NOTIFICATION BELL (v2.11)
   Bottom-right fixed position
   ===================================================== */

.pws-fe-notif-bell {
    position: fixed;
    bottom: 24px;
    left: auto;
    inset-inline-start: auto;
    right: 24px;
    inset-inline-end: 24px;
    z-index: 10000;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pws-primary, #0a6e7c);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    transition: transform 0.15s, box-shadow 0.15s;
}

.pws-fe-notif-bell:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}

.pws-fe-notif-bell:focus-visible {
    outline: 2px solid var(--pws-primary);
    outline-offset: 3px;
}

.pws-fe-notif-bell svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.pws-fe-notif-badge {
    position: absolute;
    top: -4px;
    left: auto;
    inset-inline-start: auto;
    right: -4px;
    inset-inline-end: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 10px;
    min-width: 10px;
    text-align: center;
    display: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.pws-fe-notif-badge.has-count {
    display: block;
}

/* Dropdown (anchored above the bell, bottom-right) */
.pws-fe-notif-dropdown {
    display: none;
    position: fixed;
    bottom: 78px;
    left: auto;
    inset-inline-start: auto;
    right: 24px;
    inset-inline-end: 24px;
    width: 340px;
    max-height: 420px;
    background: var(--pws-white, #fff);
    border: 1px solid var(--pws-border, #e0e0e0);
    border-radius: var(--pws-radius, 8px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 10001;
    overflow: hidden;
}

.pws-fe-notif-dropdown.is-open {
    display: flex;
    flex-direction: column;
}

.pws-fe-notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--pws-border, #e0e0e0);
    flex-shrink: 0;
}

.pws-fe-notif-dropdown-header strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--pws-text);
}

.pws-fe-notif-dropdown-header a {
    font-size: 12px;
    color: var(--pws-primary);
    text-decoration: none;
}

.pws-fe-notif-dropdown-header a:hover {
    text-decoration: underline;
}

.pws-fe-notif-dropdown-list {
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
}

.pws-fe-notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--pws-text-muted, #666);
    font-size: 13px;
}

.pws-fe-notif-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--pws-border, #e0e0e0);
    text-align: center;
    flex-shrink: 0;
}

.pws-fe-notif-dropdown-footer a {
    font-size: 12px;
    color: var(--pws-primary);
    text-decoration: none;
    font-weight: 500;
}

.pws-fe-notif-dropdown-footer a:hover {
    text-decoration: underline;
}

/* Notification items */
.pws-fe-notif-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 16px;
    border-bottom: 1px solid var(--pws-border, rgba(0,0,0,0.06));
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}

.pws-fe-notif-item:hover {
    background: var(--pws-bg, #f0f2f5);
    text-decoration: none;
}

.pws-fe-notif-item.is-unread {
    background: rgba(10, 110, 124, 0.04);
}

.pws-fe-notif-item.is-unread:hover {
    background: rgba(10, 110, 124, 0.08);
}

.pws-fe-notif-item-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pws-primary);
    margin-top: 5px;
    margin-right: 10px;
    margin-inline-end: 10px;
    flex-shrink: 0;
    display: none;
}

.pws-fe-notif-item.is-unread .pws-fe-notif-item-dot {
    display: block;
}

.pws-fe-notif-item-content {
    flex: 1;
    min-width: 0;
}

.pws-fe-notif-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--pws-text);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pws-fe-notif-item-body {
    font-size: 12px;
    color: var(--pws-text-muted);
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pws-fe-notif-item-time {
    font-size: 11px;
    color: var(--pws-text-muted);
    opacity: 0.7;
}

/* Mobile: full-width dropdown */
@media (max-width: 480px) {
    .pws-fe-notif-dropdown {
        right: 8px;
        inset-inline-end: 8px;
        left: 8px;
        inset-inline-start: 8px;
        width: auto;
        bottom: 78px;
    }

    .pws-fe-notif-bell {
        bottom: 16px;
        right: 16px;
        inset-inline-end: 16px;
    }
}

/* =====================================================================
   EXTERNAL MODULE COMPATIBILITY (v2.11.0)
   Maps WordPress admin CSS classes to ERP frontend styles when used
   within .pws-content-body (e.g., Construction module)
   ===================================================================== */

/* Neutralize admin wrapper */
.pws-content-body .wrap {
    margin: 0;
    padding: 0;
}

/* Tables: map wp-list-table to pws-app-table */
.pws-content-body .wp-list-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--pws-white);
    border: 1px solid var(--pws-border);
    border-radius: 8px;
    overflow: hidden;
}
.pws-content-body .wp-list-table th {
    text-align: left;
    text-align: start;
    padding: 12px 15px;
    font-size: var(--pws-font-table-head, 11px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--pws-text-muted, #8898aa);
    background: var(--pws-bg, #f8f9fa);
    border-bottom: 2px solid var(--pws-border, #e3e8ee);
}
.pws-content-body .wp-list-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--pws-border, #e3e8ee);
    vertical-align: middle;
    font-size: 14px;
}
.pws-content-body .wp-list-table tbody tr:hover {
    background: #fafafa;
}

/* Cards */
.pws-content-body .card,
.pws-content-body div[style*="border: 1px solid #ccd0d4"] {
    background: var(--pws-white, #fff);
    border: 1px solid var(--pws-border, #e3e8ee) !important;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: none;
    max-width: none;
}

/* Form tables */
.pws-content-body .form-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 20px;
}
.pws-content-body .form-table th {
    padding: 12px 10px 12px 0;
    font-weight: 600;
    font-size: 14px;
    vertical-align: top;
    text-align: left;
    text-align: start;
    width: 200px;
    color: var(--pws-text, #32325d);
}
.pws-content-body .form-table td {
    padding: 10px;
}
.pws-content-body .form-table input[type="text"],
.pws-content-body .form-table input[type="number"],
.pws-content-body .form-table input[type="date"],
.pws-content-body .form-table input[type="email"],
.pws-content-body .form-table input[type="url"],
.pws-content-body .form-table textarea,
.pws-content-body .form-table select {
    width: 100%;
    max-width: 500px;
    padding: 8px 12px;
    border: 1px solid var(--pws-border, #e3e8ee);
    border-radius: 6px;
    font-size: 14px;
    color: var(--pws-text, #32325d);
    background: var(--pws-white, #fff);
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.pws-content-body .form-table input:focus,
.pws-content-body .form-table textarea:focus,
.pws-content-body .form-table select:focus {
    border-color: var(--pws-primary, #3b82f6);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* Buttons */
.pws-content-body .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--pws-border, #e3e8ee);
    border-radius: 6px;
    background: var(--pws-white, #fff);
    color: var(--pws-text, #32325d);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.4;
}
.pws-content-body .button:hover {
    background: var(--pws-bg, #f8f9fa);
    border-color: var(--pws-primary, #3b82f6);
    color: var(--pws-primary, #3b82f6);
}
.pws-content-body .button-primary {
    background: var(--pws-primary, #3b82f6);
    color: var(--pws-white, #fff);
    border-color: var(--pws-primary, #3b82f6);
}
.pws-content-body .button-primary:hover {
    background: var(--pws-primary-dark, #2563eb);
    border-color: var(--pws-primary-dark, #2563eb);
    color: var(--pws-white, #fff);
}
.pws-content-body .button-small {
    padding: 4px 10px;
    font-size: 12px;
}
.pws-content-body a.button {
    text-decoration: none;
}

/* Page title action (Add New button next to H1) */
.pws-content-body .page-title-action {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--pws-primary, #3b82f6);
    border-radius: 6px;
    background: var(--pws-primary, #3b82f6);
    color: var(--pws-white, #fff);
    text-decoration: none;
    margin-left: 10px;
    margin-inline-start: 10px;
    vertical-align: middle;
}
.pws-content-body .page-title-action:hover {
    background: var(--pws-primary-dark, #2563eb);
}

/* Notices */
.pws-content-body .notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 0 0 16px;
    border-left: 4px solid;
    border-inline-start: 4px solid;
}
.pws-content-body .notice-success {
    background: #d4edda;
    border-left-color: #28a745;
    border-inline-start-color: #28a745;
    color: #155724;
}
.pws-content-body .notice-error {
    background: #f8d7da;
    border-left-color: #dc3545;
    border-inline-start-color: #dc3545;
    color: #721c24;
}
.pws-content-body .notice-warning {
    background: #fff3cd;
    border-left-color: #ffc107;
    border-inline-start-color: #ffc107;
    color: #856404;
}
.pws-content-body .notice p {
    margin: 0;
}

/* Pagination (tablenav) */
.pws-content-body .tablenav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-top: 10px;
}
.pws-content-body .tablenav-pages {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--pws-text-muted, #8898aa);
}
.pws-content-body .pagination-links {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pws-content-body .tablenav-pages-navspan.disabled {
    opacity: 0.4;
    cursor: default;
}
.pws-content-body .displaying-num {
    margin-right: 12px;
    margin-inline-end: 12px;
}
.pws-content-body .paging-input {
    font-weight: 600;
}

/* Search box */
.pws-content-body .search-box {
    display: flex;
    gap: 8px;
    align-items: center;
}
.pws-content-body .search-box input[type="search"] {
    padding: 8px 12px;
    border: 1px solid var(--pws-border, #e3e8ee);
    border-radius: 6px;
    font-size: 14px;
    min-width: 240px;
}
.pws-content-body .search-box input[type="search"]:focus {
    border-color: var(--pws-primary, #3b82f6);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* WP header end line */
.pws-content-body .wp-header-end {
    display: none;
}

/* Heading inline */
.pws-content-body .wp-heading-inline {
    font-size: 20px;
    font-weight: 600;
    color: var(--pws-text, #32325d);
    margin: 0 0 16px;
    display: inline-block;
}

/* Status filter form */
.pws-content-body form[style*="display:inline-block"] {
    margin-bottom: 16px;
}
.pws-content-body form[style*="display:inline-block"] select {
    padding: 6px 10px;
    border: 1px solid var(--pws-border, #e3e8ee);
    border-radius: 6px;
    font-size: 13px;
}

/* Description list / details in contract view */
.pws-content-body table[style*="border-collapse"] td {
    padding: 8px 12px;
}

/* KPI cards in dashboard — override generic p/h3 within card-style divs */
.pws-content-body div[style*="display: flex"] > div[style*="border-radius"] {
    border-color: var(--pws-border, #e3e8ee) !important;
}

/* Responsive: ensure tables scroll on mobile */
@media (max-width: 768px) {
    .pws-content-body .wp-list-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .pws-content-body .form-table th {
        display: block;
        width: 100%;
        padding-bottom: 4px;
    }
    .pws-content-body .form-table td {
        display: block;
        padding-left: 0;
        padding-inline-start: 0;
    }
    .pws-content-body .form-table input[type="text"],
    .pws-content-body .form-table input[type="number"],
    .pws-content-body .form-table input[type="date"],
    .pws-content-body .form-table textarea,
    .pws-content-body .form-table select {
        max-width: 100%;
    }
    .pws-content-body .search-box {
        flex-wrap: wrap;
    }
    .pws-content-body .search-box input[type="search"] {
        min-width: 0;
        flex: 1;
    }
}

/* =====================================================
   FILES MODULE ENHANCEMENTS (v2.13.0)
   ===================================================== */

/* Drag & Drop Zone */
.pws-dropzone {
    border: 2px dashed var(--pws-border);
    border-radius: var(--pws-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    background: var(--pws-bg);
}

.pws-dropzone:hover {
    border-color: var(--pws-primary);
    background: var(--pws-primary-light);
}

.pws-dropzone.pws-drag-active {
    border-color: var(--pws-primary);
    background: var(--pws-primary-light);
    border-style: solid;
}

.pws-dropzone-inner .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: var(--pws-primary);
    display: block;
    margin: 0 auto 12px;
}

.pws-dropzone-inner p {
    margin: 0 0 6px;
    font-size: var(--pws-font-base);
    color: var(--pws-text);
}

.pws-dropzone-inner a {
    color: var(--pws-primary);
    font-weight: 600;
    text-decoration: underline;
}

.pws-dropzone-inner small {
    color: var(--pws-text-muted);
    font-size: var(--pws-font-small);
}

/* Upload Queue */
.pws-upload-queue {
    margin-top: 12px;
    border: 1px solid var(--pws-border);
    border-radius: var(--pws-radius);
    max-height: 200px;
    overflow-y: auto;
}

.pws-upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--pws-border);
    font-size: var(--pws-font-small);
}

.pws-upload-item:last-child {
    border-bottom: none;
}

.pws-upload-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: var(--pws-text-muted);
}

.pws-upload-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.pws-upload-size {
    color: var(--pws-text-muted);
    white-space: nowrap;
}

.pws-upload-remove {
    background: none;
    border: none;
    color: var(--pws-danger);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.pws-upload-remove:hover {
    color: #c0392b;
}

/* Upload Meta Row */
.pws-upload-meta {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--pws-border);
}

.pws-form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.pws-form-inline .pws-form-group {
    flex: 1;
    min-width: 140px;
}

.pws-form-inline .pws-form-group label {
    display: block;
    font-size: var(--pws-font-small);
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--pws-text-muted);
}

.pws-form-inline .pws-form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--pws-border);
    border-radius: var(--pws-radius-sm);
    font-size: var(--pws-font-small);
    background: var(--pws-white);
}

.pws-form-inline .pws-form-group-submit {
    flex: 0 0 auto;
    min-width: auto;
}

/* Category Badge */
.pws-badge-category {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.6;
}

/* Files Filters Row */
.pws-files-filters {
    margin-bottom: 16px;
}

.pws-files-filters .pws-app-filters {
    margin-bottom: 12px;
}

.pws-files-filters .pws-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pws-files-filters .pws-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.pws-files-filters select {
    padding: 8px 10px;
    border: 1px solid var(--pws-border);
    border-radius: var(--pws-radius-sm);
    font-size: var(--pws-font-small);
    background: var(--pws-white);
    min-width: 150px;
}

/* Search inline */
.pws-search-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-inline-start: auto;
}

.pws-search-inline input[type="text"] {
    padding: 8px 10px;
    border: 1px solid var(--pws-border);
    border-radius: var(--pws-radius-sm);
    font-size: var(--pws-font-small);
    min-width: 180px;
}

.pws-search-inline input[type="text"]:focus {
    border-color: var(--pws-primary);
    outline: none;
}

/* Preview Modal (larger) */
.pws-modal-lg {
    max-width: 800px !important;
}

.pws-preview-body {
    padding: 20px;
    text-align: center;
}

.pws-preview-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--pws-radius);
}

.pws-preview-body iframe {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: var(--pws-radius);
}

/* Small table variant for modals */
.pws-table-sm {
    font-size: var(--pws-font-small);
}

.pws-table-sm th,
.pws-table-sm td {
    padding: 6px 10px;
}

/* Responsive: Files Module */
@media (max-width: 768px) {
    .pws-dropzone {
        padding: 24px 16px;
    }
    .pws-dropzone-inner .dashicons {
        font-size: 36px;
        width: 36px;
        height: 36px;
    }
    .pws-form-inline {
        flex-direction: column;
    }
    .pws-form-inline .pws-form-group {
        min-width: 100%;
    }
    .pws-files-filters .pws-filter-form {
        flex-direction: column;
    }
    .pws-files-filters select {
        width: 100%;
    }
    .pws-search-inline {
        width: 100%;
        margin-inline-start: 0;
    }
    .pws-search-inline input[type="text"] {
        flex: 1;
        min-width: 0;
    }
    .pws-modal-lg {
        max-width: 95% !important;
    }
}

/* =====================================================
   UNIFIED SEARCH FORM COMPONENT
   Modern search with icon, clear button & responsive
   ===================================================== */
.pws-search-form {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
    max-width: 520px;
    position: relative;
}

/* Input wrapper — holds icon + input + clear */
.pws-search-form .pws-search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

/* Search icon — inline SVG inside span */
.pws-search-form .pws-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
    z-index: 2;
    display: block;
    line-height: 0;
}

.pws-search-form .pws-search-icon svg {
    width: 18px;
    height: 18px;
    stroke: #98a2b3;
    stroke-width: 2;
    fill: none;
    display: block;
}

/* The search text input */
.pws-search-form input[type="text"],
.pws-search-form input[type="search"] {
    width: 100% !important;
    padding: 10px 40px 10px 42px !important;
    border: 1.5px solid #d0d5dd !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-family: inherit;
    background: #fff !important;
    color: #1d2939 !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    outline: none !important;
    line-height: 1.4;
    height: auto;
    margin: 0;
    min-width: 0;
}

.pws-search-form input[type="text"]::placeholder,
.pws-search-form input[type="search"]::placeholder {
    color: #98a2b3;
    opacity: 1;
}

.pws-search-form input[type="text"]:focus,
.pws-search-form input[type="search"]:focus {
    border-color: var(--pws-primary, #2563eb) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

/* Clear (×) button inside input */
.pws-search-form .pws-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e4e7ec;
    color: #667085;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border: none;
    padding: 0;
    z-index: 2;
}

.pws-search-form .pws-search-clear:hover {
    background: #667085;
    color: #fff;
}

/* Submit / Search button */
.pws-search-form button[type="submit"],
.pws-search-form .pws-search-submit,
.pws-search-form input[type="submit"] {
    padding: 10px 20px !important;
    border: 1.5px solid #d0d5dd !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: #344054 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    white-space: nowrap;
    line-height: 1.4;
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: auto;
    margin: 0;
}

.pws-search-form button[type="submit"]:hover,
.pws-search-form .pws-search-submit:hover,
.pws-search-form input[type="submit"]:hover {
    border-color: var(--pws-primary, #2563eb) !important;
    background: var(--pws-primary, #2563eb) !important;
    color: #fff !important;
}

@media (max-width: 600px) {
    .pws-search-form {
        max-width: 100%;
    }
    .pws-search-form .pws-search-input-group {
        flex: 1;
    }
}

.pws-construction-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
}

.pws-pagination-info {
    font-size: var(--pws-font-small);
    color: var(--pws-text-muted);
    margin-right: 8px;
}

.pws-pagination-current {
    font-size: var(--pws-font-table);
    font-weight: 600;
    color: var(--pws-text);
    padding: 0 8px;
}

/* Construction: Status action button variants */
.pws-btn-status-approve {
    color: #155724;
    border-color: #28a745;
}
.pws-btn-status-approve:hover {
    background: #28a745;
    color: #fff;
}

.pws-btn-status-reject {
    color: #721c24;
    border-color: #dc3545;
}
.pws-btn-status-reject:hover {
    background: #dc3545;
    color: #fff;
}

.pws-btn-status-draft {
    color: var(--pws-text-muted);
    border-color: var(--pws-border);
}

/* =====================================================
   FRONTEND APPEARANCE SETTINGS (v2.16.0)
   Two-column CSS Grid layout for Appearance tab in frontend
   ===================================================== */

.pws-fe-appearance {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Section Card ── */
.pws-fe-section {
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: var(--pws-radius, 8px);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ── Section Header (high contrast colored bar) ── */
.pws-fe-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #0a6e7c 0%, #0d8a9a 100%);
    border-bottom: 2px solid #085a66;
}

.pws-fe-section-header .dashicons {
    color: #fff;
    font-size: 18px;
    width: 18px;
    height: 18px;
    opacity: 0.9;
}

.pws-fe-section-header h2 {
    margin: 0;
    font-size: var(--pws-font-h3, 14px);
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
}

/* ── Section Body ── */
.pws-fe-section-body {
    padding: 0;
}

/* ── Subsection Title (divider within body) ── */
.pws-fe-subsection-title {
    margin: 0;
    padding: 10px 20px;
    font-size: 11px;
    font-weight: 700;
    color: #0a6e7c;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: #eef6f7;
    border-bottom: 1px solid #d0d5dd;
    border-top: 1px solid #d0d5dd;
}

.pws-fe-section-body > .pws-fe-subsection-title:first-child {
    border-top: none;
}

/* ── CSS Grid Container ── */
.pws-fe-grid {
    display: grid;
    grid-template-columns: 1fr;
}

.pws-fe-grid-2 {
    grid-template-columns: 1fr 1fr;
}

/* ── Grid Cell ── */
.pws-fe-grid-cell {
    padding: 12px 20px;
    border-bottom: 1px solid #eaecef;
    border-right: 1px solid #eaecef;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Remove right border on last column cells (every 2nd in 2-col) */
.pws-fe-grid-2 > .pws-fe-grid-cell:nth-child(2n) {
    border-right: none;
}

/* Remove bottom border on last row cells */
.pws-fe-grid > .pws-fe-grid-cell:last-child,
.pws-fe-grid-2 > .pws-fe-grid-cell:nth-last-child(-n+2):nth-child(2n+1),
.pws-fe-grid-2 > .pws-fe-grid-cell:nth-last-child(-n+2):nth-child(2n+1) ~ .pws-fe-grid-cell {
    border-bottom: none;
}

/* Alternate row striping for readability */
.pws-fe-grid-2 > .pws-fe-grid-cell:nth-child(4n+3),
.pws-fe-grid-2 > .pws-fe-grid-cell:nth-child(4n+4) {
    background: #f8fafb;
}

/* Wide cell spans both columns */
.pws-fe-grid-cell-wide {
    grid-column: 1 / -1;
    border-right: none;
}

/* ── Cell Label ── */
.pws-fe-cell-label {
    display: block;
    font-weight: 600;
    color: var(--pws-text, #1d2327);
    font-size: var(--pws-font-small, 12px);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

/* ── Hints ── */
.pws-fe-hint {
    display: block;
    font-size: 11px;
    color: var(--pws-text-muted, #888);
    margin-top: 4px;
}

/* ── Form Controls within Grid Cells ── */
.pws-fe-grid-cell input[type="text"],
.pws-fe-grid-cell input[type="url"],
.pws-fe-grid-cell input[type="number"] {
    padding: 6px 10px;
    border: 1px solid var(--pws-border, #d0d5dd);
    border-radius: 4px;
    font-size: var(--pws-font-base, 14px);
    color: var(--pws-text, #1d2327);
    max-width: 280px;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
}

.pws-fe-grid-cell input[type="number"] {
    width: 80px;
    max-width: 80px;
}

.pws-fe-grid-cell select {
    padding: 6px 10px;
    border: 1px solid var(--pws-border, #d0d5dd);
    border-radius: 4px;
    font-size: var(--pws-font-base, 14px);
    color: var(--pws-text, #1d2327);
    min-width: 140px;
    background: #fff;
}

.pws-fe-grid-cell .pws-fe-weight-select {
    min-width: 150px;
}

/* ── Inline Fields (multiple controls in a row) ── */
.pws-fe-inline-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.pws-fe-inline-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pws-fe-inline-field label {
    font-size: var(--pws-font-small, 12px);
    color: var(--pws-text-muted, #6c757d);
    white-space: nowrap;
}

.pws-fe-inline-field span {
    font-size: var(--pws-font-small, 12px);
    color: var(--pws-text-muted, #999);
}

.pws-fe-inline-field input[type="number"] {
    width: 70px !important;
    max-width: 70px !important;
}

/* ── Checkbox Label ── */
.pws-fe-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--pws-font-base, 14px);
    color: var(--pws-text, #1d2327);
    cursor: pointer;
    margin-right: 16px;
}

/* ── Color Picker Wrap ── */
.pws-fe-color-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pws-fe-color-wrap input[type="color"] {
    width: 34px;
    height: 34px;
    border: 1px solid var(--pws-border, #d0d5dd);
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    background: none;
}

.pws-fe-color-wrap input[type="text"] {
    width: 96px !important;
    max-width: 96px !important;
    font-family: monospace;
    font-size: 13px;
}

/* ── Logo / Image Fields ── */
.pws-fe-logo-field {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.pws-fe-logo-preview {
    flex-shrink: 0;
    max-width: 120px;
    border: 1px solid var(--pws-border, #e0e0e0);
    border-radius: 4px;
    padding: 4px;
    background: #fafafa;
}

.pws-fe-logo-preview img {
    display: block;
    max-width: 100%;
    height: auto;
}

.pws-fe-favicon-preview {
    flex-shrink: 0;
    width: 40px;
    border: 1px solid var(--pws-border, #e0e0e0);
    border-radius: 4px;
    padding: 4px;
    background: #fafafa;
}

.pws-fe-favicon-preview img {
    display: block;
    max-width: 100%;
    height: auto;
}

.pws-fe-logo-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pws-fe-logo-controls .pws-media-buttons {
    display: flex;
    gap: 8px;
}

.pws-fe-logo-controls .button {
    padding: 4px 12px;
    font-size: 13px;
    border-radius: 4px;
}

/* ── Export / Import Grid ── */
.pws-fe-export-import-grid {
    display: flex;
    gap: 16px;
    padding: 20px;
}

.pws-fe-export-box,
.pws-fe-import-box {
    flex: 1;
    padding: 16px;
    background: #f8fafb;
    border: 1px solid var(--pws-border, #d0d5dd);
    border-radius: 6px;
}

.pws-fe-export-box h4,
.pws-fe-import-box h4 {
    margin: 0 0 6px 0;
    font-size: var(--pws-font-base, 14px);
    font-weight: 600;
}

.pws-fe-export-box p,
.pws-fe-import-box p {
    margin: 0 0 12px 0;
    font-size: var(--pws-font-small, 12px);
    color: var(--pws-text-muted, #999);
}

.pws-fe-import-box input[type="file"] {
    margin-bottom: 8px;
    font-size: 13px;
}

/* ── Save Button ── */
.pws-fe-appearance-save {
    padding: 16px 0 0 0;
}

.pws-fe-appearance-save .button-primary {
    padding: 10px 24px;
    font-size: var(--pws-font-base, 14px);
}

/* ── Responsive: collapse to single column on small screens ── */
@media (max-width: 900px) {
    .pws-fe-grid-2 {
        grid-template-columns: 1fr;
    }

    .pws-fe-grid-cell {
        border-right: none;
    }

    /* Reset row striping for single column */
    .pws-fe-grid-2 > .pws-fe-grid-cell:nth-child(4n+3),
    .pws-fe-grid-2 > .pws-fe-grid-cell:nth-child(4n+4) {
        background: transparent;
    }

    /* Simple alternating for single column */
    .pws-fe-grid > .pws-fe-grid-cell:nth-child(even) {
        background: #f8fafb;
    }
}

@media (max-width: 600px) {
    .pws-fe-grid-cell {
        padding: 10px 14px;
    }

    .pws-fe-section-header {
        padding: 12px 14px;
    }

    .pws-fe-subsection-title {
        padding: 8px 14px;
    }

    .pws-fe-cell-label {
        font-size: 11px;
    }

    .pws-fe-inline-fields {
        flex-direction: column;
        align-items: flex-start;
    }

    .pws-fe-logo-field {
        flex-direction: column;
    }

    .pws-fe-export-import-grid {
        flex-direction: column;
        padding: 14px;
    }

    .pws-fe-color-wrap input[type="text"] {
        width: 80px !important;
    }
}
