@charset "UTF-8";

/* =========================================
   1. Normalize & Reset (Cross-Browser)
   ========================================= */
html {
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
    font-size: 16px; /* Base size */
}

@media (min-width: 2560px) {
    html { font-size: 24px; } /* 4K Scale */
}
@media (min-width: 1920px) and (max-width: 2559px) {
    html { font-size: 18px; } /* 2K Scale */
}

body { margin: 0; }
main { display: block; }
h1 { font-size: 2em; margin: 0.67em 0; }
hr { box-sizing: content-box; height: 0; overflow: visible; }
pre { font-family: monospace, monospace; font-size: 1em; }
a { background-color: transparent; }
abbr[title] { border-bottom: none; text-decoration: underline; text-decoration: underline dotted; }
b, strong { font-weight: bolder; }
code, kbd, samp { font-family: monospace, monospace; font-size: 1em; }
small { font-size: 80%; }
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
sub { bottom: -0.25em; }
sup { top: -0.5em; }
img { border-style: none; }
button, input, optgroup, select, textarea { font-family: inherit; font-size: 100%; line-height: 1.15; margin: 0; }
button, input { overflow: visible; }
button, select { text-transform: none; }
button, [type="button"], [type="reset"], [type="submit"] { -webkit-appearance: button; }
button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner { border-style: none; padding: 0; }
button:-moz-focusring, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring { outline: 1px dotted ButtonText; }
fieldset { padding: 0.35em 0.75em 0.625em; }
legend { box-sizing: border-box; color: inherit; display: table; max-width: 100%; padding: 0; white-space: normal; }
progress { vertical-align: baseline; }
textarea { overflow: auto; }
[type="checkbox"], [type="radio"] { box-sizing: border-box; padding: 0; }
[type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button { height: auto; }
[type="search"] { -webkit-appearance: textfield; outline-offset: -2px; }
[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; }
details { display: block; }
summary { display: list-item; }
template { display: none; }
[hidden] { display: none; }

:root {
    --primary-bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-indigo: #6366f1;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --border-color: #334155;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(51, 65, 85, 0.5);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; outline: none; }
body {
    margin: 0;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    background-image: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Core Visibility Class */
.hidden { display: none !important; }

/* Particle Canvas */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    background: var(--card-bg);
    padding: 0 20px;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0; /* Connects to tab content */
}
.nav-tab {
    flex: 1; /* Distribute evenly */
    text-align: center; /* Center text */
    padding: 15px 25px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    transition: all 0.2s;
}
.nav-tab:hover {
    color: var(--accent-blue);
    background: #f8fafc;
}
.nav-tab.active {
    color: var(--accent-blue);
    font-weight: bold;
}
.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-blue);
}

/* Filters & Sort */
.filter-btn-group {
    display: flex;
    gap: 10px;
    align-items: center;
}
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    background: #eff6ff;
    outline: none;
    cursor: pointer;
    font-size: 13px;
    height: 36px; /* Match input height roughly */
}
.filter-select:hover {
    border-color: var(--accent-blue);
}

/* Sort Arrows */
.sort-arrows {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    margin-left: 6px;
    height: 14px;
    width: 10px;
    justify-content: center;
}
.sort-arrow {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
    cursor: pointer;
}
.sort-arrow.up {
    border-bottom: 4px solid #64748b;
    margin-bottom: 2px;
}
.sort-arrow.down {
    border-top: 4px solid #64748b;
}

/* Search Separator */
.search-separator {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 0 5px;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}
.pagination-controls select,
.pagination-controls input {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
}
.pagination-controls input { width: 50px; text-align: center; }

/* Hide Number Input Spinners */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Chat / Message Layout Styles */
.chat-layout {
    display: flex;
    background: rgba(30, 41, 59, 0.5); /* Dark theme base */
    border: 1px solid #334155;
    border-radius: 8px;
    overflow: hidden;
}
.chat-sidebar {
    width: 250px;
    background: rgba(15, 23, 42, 0.6);
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
}
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.8);
}
.chat-header {
    padding: 15px;
    border-bottom: 1px solid #334155;
    color: #f8fafc;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    color: #cbd5e1;
}
.chat-input-area {
    padding: 15px;
    border-top: 1px solid #334155;
    display: flex;
    gap: 10px;
    background: rgba(15, 23, 42, 0.9);
}
/* Chat Contact Item & Staff Card */
.chat-contact-item, .staff-card {
    padding: 15px;
    border-bottom: 1px solid #334155;
    cursor: pointer;
    color: #cbd5e1;
    transition: background 0.2s;
}
.chat-contact-item:hover, .chat-contact-item.active,
.staff-card:hover, .staff-card.active {
    background: #334155;
    color: #f8fafc;
}

/* Staff Card Specifics */
.staff-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
}
.staff-avatar {
    width: 32px; 
    height: 32px; 
    border-radius: 50%; 
    background: var(--accent-blue); 
    color: white;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 5px;
}
.staff-name {
    font-weight: bold;
    font-size: 14px;
    color: #f8fafc;
}
.staff-phone {
    font-size: 12px;
    color: #94a3b8;
}
.latest-update-tip {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-red);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Chat Message Time */
.chat-time {
    font-size: 10px;
    color: #94a3b8;
    text-align: right;
    margin-top: 4px;
}

/* =========================================
   Restored Missing Styles
   ========================================= */

/* Layout */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px 40px 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to right, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.6));
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 1000;
}
.logo {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    outline: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}
.btn-secondary {
    background: #eff6ff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: #f8fafc;
}

/* Search Bar Components */
.search-bar {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px -10px var(--shadow-color);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    border: 1px solid var(--border-color);
    border-top: none;
}

/* Vertical spacing between wrapped rows/items (cross-browser) */
.search-bar > * {
    margin-bottom: 12px;
}
.search-bar-optimized > * + * {
    margin-top: 20px;
}

/* 功能按钮两行之间的间隔 */
.sb-row-secondary {
    margin-bottom: 10px;
}

.sb-row-secondary:last-child {
    margin-bottom: 0;
}
.filter-grid > * {
    margin-bottom: 10px;
}
.search-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 4px 6px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

@supports not (gap: 1rem) {
    .search-bar > * {
        margin-right: 15px;
        margin-bottom: 10px;
    }
    .search-bar > *:last-child {
        margin-right: 0;
    }
    .search-group > * {
        margin-right: 10px;
    }
    .search-group > *:last-child {
        margin-right: 0;
    }
    .filter-btn-group > * {
        margin-right: 10px;
    }
    .filter-btn-group > *:last-child {
        margin-right: 0;
    }
    .pagination-controls > * {
        margin-right: 10px;
    }
    .pagination-controls > *:last-child {
        margin-right: 0;
    }
}

.site-footer {
    position: relative;
    margin-top: 20px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.98));
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(6px);
    z-index: 100;
}

/* 确保页面内容较少时，Footer也能显示在底部 */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    flex: 1;
}

.site-footer-inner {
    max-width: 100%;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    color: #94a3b8;
    font-size: 13px;
}

.site-footer-col {
    min-width: 180px;
}

.site-footer-title {
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 8px;
}

.site-footer a {
    color: #94a3b8;
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.site-footer-note {
    color: #3b82f6;
    margin-top: 6px;
}
.search-label {
    font-size: 13px;
    color: var(--text-secondary);
    padding-left: 8px;
    font-weight: 500;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper input {
    border: none;
    background: transparent;
    padding: 8px;
    font-size: 14px;
    width: 100%;
    color: var(--text-primary);
}
.clear-btn {
    cursor: pointer;
    color: #94a3b8;
    font-size: 16px;
    padding: 0 5px;
    display: none; /* JS toggles this */
}
.clear-btn:hover { color: var(--accent-red); }

/* Table */
.table-container {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px -5px var(--shadow-color);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.msg-center-card {
    flex-direction: column;
    align-items: stretch;
    margin: 0 0 20px 0;
}

.msg-center-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.msg-center-btn {
    position: relative;
}

.msgcenter-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    display: inline-block;
    text-align: center;
}

.msg-center-content {
    width: auto;
    margin: 0 0 20px 0;
}
table { width: 100%; border-collapse: collapse; }
th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: var(--text-primary);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Status Badges */
.status-badge {
    padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.status-active { background: #dcfce7; color: #166534; }
.status-pending { background: #fef9c3; color: #854d0e; }
.status-inactive { background: #f1f5f9; color: #64748b; }
.status-replied { background: #dbeafe; color: #1e40af; }
.status-bad { background: #fee2e2; color: #991b1b; }
.status-ok { background: #dcfce7; color: #166534; }

/* Links */
.link { color: var(--accent-blue); cursor: pointer; text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* Modals */
.modal, .modal-mask {
    display: none; 
    position: fixed; 
    z-index: 999999;
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center; 
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-content {
    background-color: white; 
    padding: 0; 
    border-radius: 16px;
    width: 500px; 
    max-width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    animation: slideUp 0.3s ease-out;
    display: flex; 
    flex-direction: column; 
    max-height: 90vh;
}
.modal-header {
    padding: 20px 24px; 
    border-bottom: 1px solid var(--border-color);
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    font-weight: bold; 
    font-size: 18px;
}
.close { font-size: 24px; color: var(--text-secondary); cursor: pointer; transition: 0.2s; }  
.close:hover { color: var(--accent-red); transform: rotate(90deg); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer {
    padding: 20px 24px; 
    border-top: 1px solid var(--border-color);
    display: flex; 
    justify-content: flex-end; 
    gap: 12px;
}

/* Auth Pages & Forms */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: radial-gradient(circle at center, #ffffff 0%, #eef2f7 100%);
}
.login-box {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px var(--shadow-color);
    width: 400px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}
.login-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    color: var(--text-primary);
}
.input-group { margin-bottom: 20px; position: relative; text-align: left; }
.input-group label {
    display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--text-secondary);
}
.input-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background: rgba(255,255,255,0.8);
}
.input-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 200002;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

#accountBtn {
    min-width: 180px;
    justify-content: center;
}
/* Account Menu */
#accountMenu {
    position: absolute;
    top: 50px;
    right: 0;
    width: 180px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 10px 0;
    z-index: 1001 !important;
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    text-align: center;
}
.menu-item, .account-menu-item {
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    font-size: 14px;
    display: block;
}
.menu-item:hover, .account-menu-item:hover {
    background-color: #f1f5f9;
    color: var(--accent-blue);
}

/* Message Badge */
.message-badge {
    display: none;
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-red);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    min-width: 16px;
    text-align: center;
    line-height: 12px;
}

/* Query Badge (Red Dot) */
#btnQueryBadge {
    display:none;
    position:absolute;
    top:-3px;
    right:-3px;
    background:red;
    border-radius:50%;
    width:8px;
    height:8px;
}

/* Account Menu Item (Fix for missing class) - Merged with above */
/* .account-menu-item { ... } already defined above */

/* Custom Alert & Confirm Overlay (ADDED) */
.custom-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none; /* Controlled by JS */
    justify-content: center;
    align-items: center;
    z-index: 2147483647; /* Highest possible z-index */
    backdrop-filter: blur(4px);
}

.custom-alert-box {
    background: white;
    width: 300px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
    display: flex;
    flex-direction: column;
}

.custom-alert-content {
    padding: 20px;
    text-align: center;
    color: #333;
    font-size: 15px;
    line-height: 1.5;
    border-bottom: 1px solid #f0f0f0;
}

.custom-alert-btn {
    width: 100%;
    padding: 12px;
    border: none;
    background: white;
    color: #3b82f6;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-alert-btn:hover {
    background: #f8fafc;
}

.custom-alert-btn:active {
    background: #eff6ff;
}

/* Footer Styles */
.footer {
    background: #f8fafc;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #e2e8f0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    color: #64748b;
    font-size: 14px;
    padding: 0 20px;
}

.footer-link {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #3b82f6;
}

/* Header Module Switch */
.module-switch {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    flex: 1; /* Center in the header */
    margin: 0 20px;
}

.module-btn {
    padding: 8px 24px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
}

.module-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: #f8fafc;
}

.module-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Responsive & Unified Search Bar (New) */

.search-bar-optimized {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Increased gap between rows */
    padding: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

/* Rows */
.sb-row-primary {
    display: flex;
    gap: 15px;
    align-items: center;
    width: 100%;
}

.sb-row-secondary {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Input Group (Label + Input + Clear) */
.unified-input-group {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 12px;
    flex: 1;
    height: 40px; /* Reduced height from 2.75rem (44px) to 40px */
    transition: all 0.3s ease;
    min-width: 200px;
}

.unified-input-group:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

.unified-label {
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-right: 8px;
    padding-right: 8px;
    border-right: 1px solid #e2e8f0;
    height: 20px;
    line-height: 20px;
    display: flex;
    align-items: center;
}

.unified-input {
    flex: 1;
    border: none;
    background: transparent;
    height: 100%;
    font-size: 14px;
    color: var(--text-primary);
    width: 100%;
}

/* Filter Grid */
.filter-grid {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    width: 100%; /* Occupy full width */
}

/* Unified Select */
.unified-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 24px 0 10px;
    font-size: 13px;
    color: var(--text-primary);
    height: 40px; /* Match input height */
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    transition: all 0.2s;
    min-width: 80px;
    flex: 1; /* Distribute space evenly */
}

.unified-select:hover, .unified-select:focus {
    border-color: var(--accent-blue);
}

/* Unified Buttons */
.unified-btn {
    height: 40px; /* Match input height */
    padding: 0 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.unified-btn-primary {
    background: var(--accent-blue);
    color: white;
}

.unified-btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.unified-btn-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

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

/* Responsive Grid for Filters */
.filter-grid {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== Cross-browser spacing hardening (do not rely on flex gap) ===== */
.sb-row-primary,
.sb-row-secondary,
.filter-grid,
.filter-btn-group,
.pagination-controls,
.module-switch {
    gap: 0 !important;
}

.sb-row-primary > * + *,
.sb-row-secondary > * + *,
.filter-grid > * + *,
.filter-btn-group > * + *,
.pagination-controls > * + *,
.module-switch > * + * {
    margin-left: 15px;
}

/* Clear Button */
.unified-clear-btn {
    cursor: pointer;
    color: #cbd5e1;
    font-size: 1.2rem;
    padding: 0 0.5rem;
    display: none;
    line-height: 1;
}

.unified-clear-btn:hover {
    color: var(--accent-red);
}

/* Large Screen Optimization (Media Query already set root font-size, but specific spacing can be adjusted) */
@media (min-width: 1920px) {
    .search-bar-optimized {
        gap: 1.5rem;
        padding: 2rem;
    }
    .sb-row-primary, .sb-row-secondary {
        gap: 1.5rem;
    }
}
