:root { 
    /* --- LSU BRAND PALETTE --- */
    --lsu-purple: #461D7C; 
    --lsu-gold: #FDD023; 
    
    /* Light Mode Defaults */
    --app-primary: var(--lsu-purple); 
    --app-accent: var(--lsu-purple); 
    /* v2.5.105: hover outline thickening (inset ring, no geometry change) */
    --card-hover-ring: var(--lsu-purple);
    
    --bg-app: #f8fafc;       
    --bg-sidebar: #edf2f7;   
    --bg-card: #ffffff;      
    
    --bg-controls: rgba(255,255,255,0.8); 
    --bg-viewer: #64748b;    
    --bg-input: #ffffff; 
    
    --text-primary: #1e293b; 
    --text-secondary: #64748b; 
    
    /* v1.66: High Contrast Borders */
    --border-color: #b6c1d0; 

    /* BADGES */
    --match-green-bg: #15803d; 
    --match-green-text: #ffffff; 
    --match-orange-bg: #ea580c; 
    --match-orange-text: #ffffff;
    --match-red-bg: #dc2626; 
    --match-red-text: #ffffff;
    
    --match-keyword-bg: var(--match-green-bg); 
    --match-keyword-text: var(--match-green-text);

    --demo-border: var(--lsu-purple); 
    --demo-bg: rgba(70, 29, 124, 0.05);
    --redaction-outline: #e5e7eb; 
    --redaction-fill: #ffffff; 
    --cad-text: #000000;           
    --app-viewport-height: 100vh;
    --header-base-height: 72px; 
    --input-height: 36px; 
    --sidebar-width: 300px;
    
    /* GLASS STYLES */
    --glass-bg: rgba(70, 29, 124, 0.1);
    --glass-border: rgba(70, 29, 124, 0.2);
    --glass-text: var(--lsu-purple);
    --surface-soft-border: rgba(148, 163, 184, 0.42);
    --surface-seam-border: rgba(148, 163, 184, 0.56);
    --shell-divider-soft: #c4cfdd;
    --shell-divider-strong: #b0becf;
    --shell-divider-highlight: rgba(255, 255, 255, 0.76);
    --surface-soft-shadow: 0 1px 4px rgba(15, 23, 42, 0.09);
    --panel-id-color: var(--app-primary);
    
    accent-color: var(--lsu-purple);
    color-scheme: light; 
}

@supports (height: 100svh) {
    :root {
        --app-viewport-height: 100svh;
    }
}

@supports (height: 100dvh) {
    :root {
        --app-viewport-height: 100dvh;
    }
}

body.dark-mode {
    --bg-app: #0f0f0f;        
    --bg-sidebar: #1b1b20;    
    --bg-card: #27272a;       
    --bg-controls: rgba(24, 24, 27, 0.98); 
    --bg-viewer: #000000; 
    --bg-input: #3f3f46;      
    
    --text-primary: #f4f4f5; 
    --text-secondary: #a1a1aa; 
    --border-color: #4a4a57;

    --app-primary: var(--lsu-purple); 
    --app-accent: var(--lsu-purple);
    --card-hover-ring: rgba(167, 139, 250, 0.6);

    --match-green-bg: #15803d; 
    --match-green-text: #ffffff; 
    --match-orange-bg: #ea580c; 
    --match-orange-text: #ffffff;
    --match-red-bg: #dc2626; 
    --match-red-text: #ffffff;
    --match-keyword-bg: var(--match-green-bg); 
    --match-keyword-text: var(--match-green-text);

    --demo-border: #A78BFA; 
    --demo-bg: rgba(167, 139, 250, 0.1);
    
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-text: #ffffff;
    --surface-soft-border: rgba(161, 161, 170, 0.32);
    --surface-seam-border: rgba(161, 161, 170, 0.42);
    --surface-soft-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
    --panel-id-color: #5a2a99;

    color-scheme: dark;
    text-shadow: 1px 1px 0px #000000 !important;
}

* { box-sizing: border-box; } 

/* ========================================================
   CRITICAL FIX: Prevent Text Selection Cursor Globally
======================================================== */
html, body {
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
    min-height: var(--app-viewport-height);
}

p, h1, h2, h3, h4, h5, span, div, label {
    cursor: default;
}

input, textarea, .cox-input, .demo-input {
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text !important;
}

button, a, select, .record-card, .menu-item, .collapse-btn, .align-btn, .panel-btn, .thumb-btn, .search-btn, .keyword-toggle, .pdf-tool-btn, .page-btn, .refine-btn, input[type=range] {
    cursor: pointer !important;
}
/* ======================================================== */

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    margin: 0; padding: 0; 
    background-color: var(--bg-app); color: var(--text-primary); 
    height: var(--app-viewport-height); display: flex; flex-direction: column; overflow: hidden; 
    font-size: 13px; font-weight: 400; 
}

::-webkit-scrollbar { width: 8px; height: 8px; } 
::-webkit-scrollbar-track { background: transparent; } 
::-webkit-scrollbar-thumb { 
    background: var(--lsu-purple); 
    border-radius: 4px; 
} 
::-webkit-scrollbar-thumb:hover { background: #5a2a99; }

#auth-overlay, #feedback-modal { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.85); 
    backdrop-filter: blur(8px); 
    z-index: 99999; 
    align-items: center; justify-content: center; 
} 
.active-modal { display: flex !important; } 

.release-check-status {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin: 0 0 12px;
}
.auth-card, .config-card, .modal-card { 
    background: var(--bg-card); 
    padding: 25px; 
    border-radius: 12px; 
    width: 90%; max-width: 400px; 
    text-align: center; 
    border: 1px solid var(--surface-soft-border); 
    box-shadow: 0 16px 34px rgba(0,0,0,0.42);
    position: relative;
}
.auth-group { margin-bottom: 15px; text-align: left; }
.feedback-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; margin-bottom: 15px; }
.feedback-label { font-size: 10px; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; display: block; margin-bottom: 3px; }
.keyword-cluster { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 15px; justify-content: center; }
.keyword-toggle { background: var(--bg-input); border: 1px solid var(--border-color); padding: 4px 8px; font-size: 11px; border-radius: 12px; color: var(--text-secondary); }
.keyword-toggle.selected { background: var(--match-red-bg); color: var(--match-red-text); border-color: var(--match-red-text); }
.keyword-toggle.disabled { opacity: 0.5; pointer-events: none; }

header { 
    background: var(--lsu-purple); 
    padding-top: max(4px, env(safe-area-inset-top)); 
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    height: var(--header-base-height); min-height: var(--header-base-height); 
    display: flex; align-items: center; justify-content: space-between; 
    box-shadow: 0 2px 12px rgba(0,0,0,0.16);
    z-index: 100; flex-shrink: 0; position: relative; 
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    position: relative;
    min-width: 0;
}

.logo-group { text-decoration: none; display: flex; flex-direction: column; line-height: 1; z-index: 2; justify-content: center; min-width: 0; } 
.logo-main { font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 2.31rem; font-weight: 900; color: white; letter-spacing: -1px; text-transform: uppercase; } 
.logo-sub-row {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 3px;
    min-width: 0;
}
.logo-sub { font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 0.79rem; color: #b39ddb; font-weight: 700; letter-spacing: 4.5px; text-transform: uppercase; margin-left: 2px; flex: 0 0 auto; }
.app-title-main { 
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.79rem;
    font-weight: 700;
    color: white; 
    letter-spacing: 4.5px;
    text-shadow: none;
    line-height: 1;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
}
.app-title-version { 
    font-family: 'Inter', sans-serif;
    font-size: 14px; 
    color: rgba(255, 255, 255, 0.8); 
    font-weight: 700; 
    letter-spacing: 0px; 
    text-shadow: none !important;
}

.header-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; z-index: 2; position: relative; }
.menu-btn { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.3); color: white; width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 22px; transition: all 0.2s; backdrop-filter: blur(4px); }
.menu-btn:hover { background: rgba(255, 255, 255, 0.25); border-color: rgba(255, 255, 255, 0.5); }

.menu-dropdown { display: none; position: absolute; top: 52px; right: 0; background: var(--bg-card); border: 1px solid var(--surface-soft-border); border-radius: 10px; box-shadow: 0 12px 26px rgba(0,0,0,0.24); width: 260px; z-index: 10000; overflow: hidden; flex-direction: column; transform-origin: top right; animation: menuPop 0.15s ease-out; }
@keyframes menuPop { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.menu-dropdown.visible { display: flex; }
.menu-version {
    align-self: flex-end;
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    padding: 6px 10px 4px;
    letter-spacing: 0.4px;
    opacity: 0.9;
}
.menu-section { padding: 5px 0; border-bottom: 1px solid var(--border-color); }
.menu-section:last-child { border-bottom: none; }
.menu-header { font-size: 10px; font-weight: 800; color: var(--text-secondary); padding: 5px 12px; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; }
.menu-item { padding: 12px 15px; display: flex; align-items: center; gap: 12px; color: var(--text-primary); font-weight: 600; transition: 0.2s; font-size: 13px; text-align: left; background: none; border: none; width: 100%; }
.menu-item:hover { background: var(--bg-app); color: var(--app-primary); }
.menu-item:disabled { opacity: 0.45; cursor: not-allowed; color: var(--text-secondary); }
.menu-item:disabled:hover { background: none; color: var(--text-secondary); }
.menu-item.active-state { background: var(--app-primary); color: white; }
.menu-item.danger { color: var(--match-red-bg); }
.menu-item.danger:hover { background: var(--match-red-bg); color: var(--match-red-text); }
body.dark-mode .menu-item.danger { color: var(--match-red-text); }

#app-container { display: none; flex: 1; flex-direction: row; width: 100%; min-height: 0; height: calc(var(--app-viewport-height) - var(--header-base-height)); overflow: hidden; position: relative; } 
html.logged-in #app-container { display: flex !important; }

#sidebar-left { 
    width: var(--sidebar-width); 
    min-width: 250px; 
    background: var(--bg-sidebar); 
    border-right: 1px solid var(--surface-soft-border); 
    display: flex; flex-direction: column; z-index: 20; 
    transition: all 0.3s ease; 
    overflow: hidden; flex-shrink: 0; height: 100%; 
} 
#sidebar-left.collapsed { width: 0; min-width: 0; border: none; }

.collapse-btn { width: 18px; min-width: 18px; min-height: 0; padding: 0; background: var(--bg-controls); border: 1px solid var(--surface-seam-border); display: flex; align-items: center; justify-content: center; align-self: stretch; margin-top: 0; z-index: 100; font-weight: 800; font-size: 22px; line-height: 1; color: var(--app-primary); transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s; flex-shrink: 0; box-shadow: var(--surface-soft-shadow); user-select: none; } .collapse-btn:hover { background: var(--bg-card); border-color: var(--border-color); color: var(--text-primary); }
#toggle-left { border-radius: 0 5px 5px 0; border-left: none; margin-right: 0; }
#toggle-right { border-radius: 5px 0 0 5px; border-right: none; margin-left: 0; }

.sidebar-controls { padding: 7px; background: var(--bg-controls); border-bottom: 1px solid var(--surface-soft-border); display: flex; flex-direction: column; gap: 4px; transition: all 0.3s ease; overflow: hidden; max-height: 500px; opacity: 1; flex-shrink: 0; } 
.sidebar-controls.collapsed { max-height: 0; padding: 0; opacity: 0; border-bottom: none; }
#refine-btn-area { display: none; flex-shrink: 0; } 
#refine-btn-area.visible { display: inline-flex; }
#search-action-row #refine-btn-area {
    display: inline-flex;
    align-items: center;
}
#sidebar-left > #refine-btn-area {
    padding: 5px 6px;
    background: var(--bg-controls);
    border-bottom: 1px solid var(--surface-soft-border);
    text-align: center;
}
#sidebar-left > #refine-btn-area .refine-btn {
    width: 100%;
}

.panel-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 10px;
    background: var(--bg-input);
    border: 1px solid var(--surface-soft-border);
    color: var(--app-primary);
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    transition: 0.2s;
    text-align: center;
    box-shadow: var(--surface-soft-shadow);
}
body.dark-mode .panel-toggle-btn {
    color: #c4b5fd;
}
.panel-toggle-btn:hover {
    background: var(--bg-sidebar);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.refine-btn { width: auto; }

.filter-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px; } .input-group.full-width { grid-column: 1 / -1; } .input-group { display: flex; flex-direction: column; gap: 1px; min-width: 0; } .input-label { font-size: 9px; font-weight: 800; text-transform: uppercase; color: var(--app-primary); margin-left: 2px; letter-spacing: 0.5px; } body.dark-mode .input-label { color: var(--text-secondary); }
.input-label-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.keyword-contradiction-warning {
    color: var(--match-red-bg);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    display: none;
}

.cox-input { 
    width: 100%; height: var(--input-height); padding: 0 8px; 
    border: 1px solid var(--border-color); 
    border-radius: 4px; font-size: 12px; 
    background: var(--bg-input); color: var(--text-primary); 
    outline: none; transition: border-color 0.2s; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); 
}
.cox-input:focus { border-color: var(--app-primary); box-shadow: 0 0 0 1px var(--app-primary); } .cox-input:disabled { background: #e5e7eb; cursor: not-allowed; opacity: 0.7; }

.keyword-input-row {
    display: flex;
    align-items: stretch;
    width: 100%;
}

#keywordInput {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#keywordInput.keyword-input-blocklist-active {
    border-color: var(--match-red-bg);
}

#keywordInput.keyword-input-blocklist-active:focus {
    border-color: var(--match-red-bg);
    box-shadow: 0 0 0 1px var(--match-red-bg);
}

.keyword-blocklist-toggle {
    height: var(--input-height);
    width: var(--input-height);
    min-width: var(--input-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 4px 4px 0;
    background: var(--bg-input);
    color: var(--app-primary);
    transition: 0.2s;
}

.keyword-blocklist-toggle:hover {
    filter: brightness(1.06);
}

.keyword-blocklist-toggle:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
}

.keyword-blocklist-toggle[aria-pressed="true"] {
    background: var(--match-red-bg);
    border-color: var(--match-red-bg);
    color: var(--match-red-text);
}

.keyword-blocklist-toggle[aria-pressed="true"]:focus-visible {
    outline-color: var(--match-red-bg);
}

html.phone-ux body.dark-mode .keyword-blocklist-toggle:not([aria-pressed="true"]) {
    color: #d4c4f5;
}

.keyword-blocklist-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.keyword-blocklist-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

input[type=range] { accent-color: var(--lsu-purple); }

.search-btn { flex: 1; min-width: 0; height: 34px; background-color: var(--app-primary) !important; color: white !important; border: none; border-radius: 4px; font-weight: 800; transition: 0.2s; font-size: 11px; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; } 
.search-btn:hover { filter: brightness(1.2); }
.search-btn:disabled { background-color: #9ca3af !important; opacity: 0.7; filter: none; cursor: default !important; } 
.search-btn.error { background-color: #991b1b !important; border-color: #7f1d1d !important; }
#pdf-preview-header .search-btn { flex: none; }
#context-preview-btn { background: var(--app-primary); color: white; font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 4px; border: none; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; margin-left: auto; margin-right: 4px; transition: filter 0.2s; }
#context-preview-btn:hover { filter: brightness(1.2); }

.reset-btn { height: 34px; width: 34px; background: var(--app-primary); border: 1px solid var(--app-primary); border-radius: 4px; color: #ffffff; font-weight: 800; } 
.reset-btn:hover { filter: brightness(1.08); }

#search-action-row {
    background: transparent;
    border: none;
    border-top: 1px solid var(--surface-soft-border);
    border-radius: 0;
    padding: 4px 0 0;
    box-shadow: none;
}

body:not(.dark-mode) #search-action-row {
    border-top-color: var(--shell-divider-strong);
}
#results-scroll-area { flex: 1; overflow: hidden; padding: 6px; background: var(--bg-sidebar); min-height: 0; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--surface-seam-border); border-bottom: none; border-radius: 10px 10px 0 0; box-shadow: var(--surface-soft-shadow); } 
#results-header { display: none; align-items: center; justify-content: space-between; gap: 8px; }
body.results-ready #results-header { display: flex; }
#results-count { font-size: 9px; font-weight: 800; color: var(--app-primary); letter-spacing: 0.5px; text-transform: uppercase; order: 2; margin-left: auto; text-align: right; }
body.dark-mode #results-count { color: #c4b5fd; }
#results-list { flex: 1; min-height: 0; overflow-y: auto; }
#results-area { display: flex; flex-direction: column; gap: 4px; padding: 8px 8px 10px; transition: opacity 0.2s ease; }
.panel-list-unavailable { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 8px; color: var(--text-secondary); font-size: 12px; font-weight: 600; line-height: 1.35; }
.panel-list-unavailable p { margin: 0; }
.panel-list-retry { height: 28px; padding: 0 12px; background: var(--app-primary); color: #fff; border: none; border-radius: 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.4px; cursor: pointer; }
.panel-list-retry:hover { filter: brightness(1.12); }
.results-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    order: 1;
    margin-right: auto;
}

#left-generator-context {
    padding: 6px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--surface-soft-border);
    flex-shrink: 0;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 40vh;
}

#pagination-footer {
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--surface-seam-border);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    display: none; 
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: var(--surface-soft-shadow);
}
.page-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: 0.2s;
}
.page-btn:hover:not(:disabled) { border-color: var(--app-primary); color: var(--app-primary); }
.page-btn:disabled { opacity: 0.5; cursor: default !important; }
.page-info { font-size: 11px; font-weight: 700; color: var(--text-secondary); }

.record-card { background: var(--bg-card); padding: 6px 8px; border-radius: 6px; border: 1px solid var(--surface-seam-border); border-left: 4px solid var(--app-primary); box-shadow: var(--surface-soft-shadow); position: relative; transition: transform 0.2s ease, box-shadow 0.2s ease; display: flex; flex-direction: column; gap: 4px; } 
.record-card:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px var(--card-hover-ring), var(--surface-soft-shadow), 0 2px 5px rgba(0,0,0,0.1); } 
.panel-name { font-size: 14px; font-weight: 800; color: var(--panel-id-color); margin: 0; letter-spacing: -0.3px; line-height: 1.1; } 
.badge-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 2px; padding: 0; background: none; border: none; border-radius: 0; }

.hud-badge { font-size: 9px; font-weight: 800; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; letter-spacing: 0.3px; } 
.hud-badge.match-green { background: var(--match-green-bg); color: var(--match-green-text); } 
.hud-badge.match-orange { background: var(--match-orange-bg); color: var(--match-orange-text); }
.hud-badge.match-red { background: var(--match-red-bg); color: var(--match-red-text); } 
.hud-badge.match-keyword { background: var(--match-keyword-bg); color: var(--match-keyword-text); } 
.hud-badge.no-pdf { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; } 
.hud-badge.unknown { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }

.record-card.no-pdf-card {
    opacity: 0.65;
    cursor: not-allowed !important; /* beats the global interactive cursor: pointer !important */
    border-left-color: #9ca3af;
}
.record-card.no-pdf-card:hover {
    transform: none;
    box-shadow: none;
}

.thumb-btn { 
    background: #f1f5f9; 
    border: 1px solid var(--border-color); 
    border-radius: 4px; 
    width: 30px; height: 30px; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 14px; 
    transition: 0.2s; 
    color: var(--text-primary); 
    opacity: 1; 
} 
.thumb-btn:hover { background: #e2e8f0; transform: scale(1.05); }

body.dark-mode .thumb-btn { background: #2a2a2a; color: #cbd5e1; }
body.dark-mode .thumb-btn:hover { background: #3f3f46; }

#pdf-toolbar { display: none; min-height: 45px; padding: 6px 12px; background: var(--bg-sidebar); border-bottom: 1px solid var(--surface-seam-border); align-items: center; justify-content: center; gap: 10px 16px; flex-shrink: 0; flex-wrap: wrap; width: 100%; box-shadow: inset 0 -1px 0 rgba(255,255,255,0.04), var(--surface-soft-shadow); border-radius: 0; box-sizing: border-box; }
body.pdf-toolbar-session-ready #pdf-toolbar { display: flex; }
#pdf-toolbar .pdf-tool-btn {
    background: var(--bg-card);
    border: 1px solid var(--surface-seam-border);
    color: var(--text-primary);
    border-radius: 6px;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    font-weight: 700;
    box-shadow: var(--surface-soft-shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
#pdf-toolbar .pdf-tool-btn:hover { filter: brightness(1.06); }
#pdf-toolbar .pdf-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: none;
}
#pdf-toolbar .pdf-tool-btn-icon { line-height: 1; }
#pdf-toolbar .pdf-tool-btn-label { white-space: nowrap; }
#pdf-toolbar .pdf-download-control {
    position: relative;
    display: inline-flex;
    align-items: center;
}
#pdf-toolbar .pdf-maintain-position-btn {
    transition: 0.2s;
}
#pdf-toolbar .maintain-lock-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#pdf-toolbar .maintain-lock-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#pdf-toolbar .maintain-lock-icon--locked {
    display: none;
}
#pdf-toolbar .pdf-maintain-position-btn[aria-pressed="true"] {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #ffffff;
}
#pdf-toolbar .pdf-maintain-position-btn[aria-pressed="true"] .maintain-lock-icon--unlocked {
    display: none;
}
#pdf-toolbar .pdf-maintain-position-btn[aria-pressed="true"] .maintain-lock-icon--locked {
    display: inline-flex;
}
#pdf-toolbar .pdf-maintain-position-btn:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
}
#pdf-toolbar .pdf-maintain-position-btn[aria-pressed="true"]:focus-visible {
    outline-color: #ffffff;
    box-shadow: 0 0 0 2px var(--app-primary), var(--surface-soft-shadow);
}
#pdf-toolbar .pdf-toolbar-hint {
    display: none;
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    z-index: 5;
    width: max-content;
    max-width: min(220px, calc(100vw - 48px));
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--surface-seam-border);
    background: var(--bg-card);
    box-shadow: var(--surface-soft-shadow);
    color: var(--text-primary);
    font-size: 11px;
    line-height: 1.3;
    white-space: normal;
    pointer-events: auto;
}
#pdf-toolbar .pdf-toolbar-hint-action {
    margin-top: 8px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--surface-seam-border);
    background: var(--bg-sidebar);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
}
#pdf-toolbar .pdf-download-control.tooltip-visible .pdf-toolbar-hint {
    display: block;
}
#pdf-toolbar .pdf-toolbar-hint::after {
    content: '';
    position: absolute;
    left: 18px;
    top: 100%;
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: var(--bg-card) transparent transparent transparent;
}
body:not(.dark-mode) #pdf-toolbar .pdf-toolbar-hint {
    border-color: var(--shell-divider-strong);
}
body:not(.dark-mode) #pdf-toolbar .pdf-toolbar-hint-action {
    border-color: var(--shell-divider-strong);
}
#pdf-zoom-level { color: var(--text-primary); font-weight: 700; min-width: 40px; text-align: center; }

body:not(.dark-mode) #sidebar-left {
    border-right-color: var(--shell-divider-strong);
    box-shadow: inset -1px 0 0 var(--shell-divider-highlight);
}

body:not(.dark-mode) #results-scroll-area,
body:not(.dark-mode) #pagination-footer,
body:not(.dark-mode) .record-card,
body:not(.dark-mode) #pdf-toolbar,
body:not(.dark-mode) #pdf-toolbar .pdf-tool-btn,
body:not(.dark-mode) .collapse-btn {
    box-shadow: inset 0 1px 0 var(--shell-divider-highlight), var(--surface-soft-shadow);
}

body:not(.dark-mode) #results-scroll-area,
body:not(.dark-mode) #pagination-footer {
    border-color: var(--shell-divider-strong);
}

/* v2.5.104: selection adds an outer ring and compact glow without changing card geometry.
   Precedence: normal/hover = purple (v2.5.105: hover adds a 1px inset ring so the outline
   reads thicker without changing size); active-view = theme tint + ring + glow;
   no-PDF (disabled) = neutral outline + gray left accent, no hover lift (beats the hover rule). */
body:not(.dark-mode) .record-card {
    border-color: var(--app-primary);
}

body:not(.dark-mode) .record-card:hover {
    border-color: var(--app-primary);
    box-shadow: inset 0 0 0 1px var(--card-hover-ring), inset 0 1px 0 rgba(255, 255, 255, 0.84), var(--surface-soft-shadow), 0 2px 5px rgba(15, 23, 42, 0.12);
}

body:not(.dark-mode) .record-card.active-view:not(.no-pdf-card) {
    background: #f3eef9;
    border-color: var(--app-primary);
    box-shadow: inset 0 1px 0 var(--shell-divider-highlight), var(--surface-soft-shadow), 0 0 0 2px rgba(70, 29, 124, 0.32), 0 0 4px rgba(70, 29, 124, 0.22);
}

body:not(.dark-mode) .record-card.active-view:not(.no-pdf-card):hover {
    box-shadow: inset 0 0 0 1px var(--card-hover-ring), inset 0 1px 0 rgba(255, 255, 255, 0.84), var(--surface-soft-shadow), 0 2px 5px rgba(15, 23, 42, 0.12), 0 0 0 2px rgba(70, 29, 124, 0.32), 0 0 4px rgba(70, 29, 124, 0.22);
}

body.dark-mode .record-card.active-view:not(.no-pdf-card) {
    background: #302c3b;
    border-color: var(--app-primary);
    box-shadow: var(--surface-soft-shadow), 0 0 0 2px rgba(167, 139, 250, 0.42), 0 0 4px rgba(167, 139, 250, 0.24);
}

body.dark-mode .record-card.active-view:not(.no-pdf-card):hover {
    box-shadow: inset 0 0 0 1px var(--card-hover-ring), var(--surface-soft-shadow), 0 2px 5px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(167, 139, 250, 0.42), 0 0 4px rgba(167, 139, 250, 0.24);
}

body:not(.dark-mode) .record-card.no-pdf-card,
body:not(.dark-mode) .record-card.no-pdf-card:hover {
    border-color: var(--shell-divider-strong);
    border-left-color: #9ca3af;
    box-shadow: inset 0 1px 0 var(--shell-divider-highlight), var(--surface-soft-shadow);
}

@media (prefers-reduced-motion: reduce) {
    .record-card {
        transition: none;
    }
    .record-card:hover {
        transform: none;
    }
}

body:not(.dark-mode) .collapse-btn {
    background: rgba(255,255,255,0.94);
    border-color: var(--shell-divider-strong);
}

body:not(.dark-mode) .collapse-btn:hover {
    border-color: #9fafc3;
}

body:not(.dark-mode) #toggle-left {
    box-shadow: inset 0 1px 0 var(--shell-divider-highlight), -1px 0 0 rgba(176, 190, 207, 0.72), var(--surface-soft-shadow);
}

body:not(.dark-mode) #toggle-right {
    box-shadow: inset 0 1px 0 var(--shell-divider-highlight), 1px 0 0 rgba(176, 190, 207, 0.72), var(--surface-soft-shadow);
}

body:not(.dark-mode) #pdf-toolbar {
    background: #f2f5fa;
    border-bottom-color: var(--shell-divider-strong);
    border-left: 1px solid var(--shell-divider-soft);
}

body:not(.dark-mode) #pdf-toolbar .pdf-tool-btn {
    border-color: var(--shell-divider-strong);
}

#preview-pane { flex: 1; background: var(--bg-viewer); display: flex; flex-direction: column; position:relative; overflow: hidden; min-width: 0; z-index: 1; }
#custom-pdf-viewer { flex: 1; width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
#pdf-main-view { flex: 1; overflow-y: auto; overflow-x: auto; display: block; padding: 20px; background: var(--bg-viewer); width:100%; height:100%; -webkit-overflow-scrolling: touch; transition: opacity 0.2s ease; touch-action: pan-y; position: relative; overflow-anchor: none; box-sizing: border-box; }
body.generator-transition #pdf-main-view { opacity: 0.6; }

.pdf-staging-host {
    position: absolute;
    inset: 0;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
    z-index: -1;
}

.pdf-gesture-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
    min-width: fit-content;
    min-height: fit-content;
    margin-inline: auto;
    transform-origin: 0 0;
    will-change: transform;
    backface-visibility: hidden;
}

.pdf-gesture-stage--staging {
    visibility: hidden;
    pointer-events: none;
    z-index: -1;
}

.pdf-page-wrapper { 
    position: relative; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); 
    background: white; 
    margin-bottom: 20px; 
    display: flex; 
    flex-direction: column;
    flex-shrink: 0;
    opacity: 1;
    animation: none;
} 

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

.page-toolbar {
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    display: none; 
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    border-bottom: 1px solid #334155;
    height: 30px; 
    flex-shrink: 0;
}
body.demo-mode .page-toolbar { display: flex; }
body.demo-mode .page-toolbar,
body.demo-mode .generator-resolution { display: none !important; }

/* CRITICAL: Ensure PDF content container and layers are properly positioned */
.pdf-content-container {
    position: relative !important; 
    width: 100%;
    height: 100%;
}

.pdf-page-canvas { 
    display: block; 
    width: 100%; 
    height: 100%;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1 !important; /* Below redaction layer */
}

body.gen-minimized .page-toolbar { display: none !important; }
body.gen-minimized .redaction-box { border: none !important; pointer-events: none !important; }
body.gen-minimized .redaction-resize-handle { display: none !important; }
body.gen-minimized .redaction-box.selected { border: none !important; z-index: 20 !important; }
/* Phone redesign only: the first tap must still select while Field Editor is minimized.
   Flag off keeps the live rules above (no hit target, no selected outline). */
html.phone-ux body.gen-minimized .redaction-box {
    pointer-events: auto !important;
    touch-action: none;
    cursor: pointer !important;
}
html.phone-ux body.gen-minimized .redaction-box.selected {
    border: 2px solid #ec4899 !important;
    background: rgba(236, 72, 153, 0.2) !important;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.5) !important;
    z-index: 100 !important;
}

/* CRITICAL: Redaction layer must be visible and interactive */
/* Z-index hierarchy: PDF canvas (1) < redaction-layer (10) < redaction-box (15) < selected box (100) */
.redaction-layer { 
    display: none; 
    position: absolute !important; 
    top: 0 !important; 
    left: 0 !important; 
    width: 100% !important; 
    height: 100% !important; 
    z-index: 10 !important; /* Above PDF canvas (z-index: 1) */
    pointer-events: auto !important; /* Must be able to interact */
} 

body.demo-mode .redaction-layer { 
    display: block !important; 
} 

/* CRITICAL: Redaction boxes must be visible in editor mode */
.redaction-box { 
    position: absolute; 
    background: transparent; 
    color: var(--cad-text); 
    font-size: 14px; 
    font-family: 'Courier New', monospace; 
    font-weight: bold; 
    display: flex !important; /* NOT hidden */
    align-items: center; 
    justify-content: center; 
    text-align: center; 
    overflow: hidden; 
    z-index: 15 !important; 
    border: none; 
    pointer-events: none; 
    box-sizing: border-box !important;
    min-width: 0;
    min-height: 0;
}

.redaction-text { white-space: pre-line; overflow: hidden; max-width: 100%; max-height: 100%; }

.redaction-box[data-transparent="false"] { 
    background: white; 
    z-index: 5;
}

/* CRITICAL: Editor mode - always show outlines and make interactive */
body.editor-active .redaction-box { 
    overflow: visible; /* resize handle sits outside the text-tight box; text is clipped by .redaction-text */
    pointer-events: auto !important; 
    touch-action: manipulation; /* flag off: a second tap edits text; the browser must not zoom */
    cursor: grab !important; 
    border: 2px solid #9333ea !important; /* Purple border - always visible */
    background: rgba(147, 51, 234, 0.15) !important; /* Semi-transparent purple */
}

/* CRITICAL: Transparent boxes in editor mode - maintain outline visibility */
body.editor-active .redaction-box[data-transparent="true"] {
    background: rgba(147, 51, 234, 0.1) !important; /* Lighter purple for transparent */
    border: 2px dashed #9333ea !important; /* Dashed border to distinguish from opaque */
}

body.editor-active .redaction-box:active { cursor: grabbing !important; }
/* A touch that starts on a zone or its handle moves that box. The page scroller
   (#pdf-main-view, touch-action: pan-y) must not steal the gesture. */
html.phone-ux body.editor-active .redaction-box,
html.phone-ux body.editor-active .redaction-resize-handle {
    touch-action: none;
} 

body.editor-active .redaction-box.selected { 
    border-color: #ec4899 !important; /* Pink when selected */
    border-style: solid !important; /* Solid border when selected */
    background: rgba(236, 72, 153, 0.2) !important;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.5) !important;
    z-index: 100 !important; 
}

/* Submittal overlays always white out the source ink under the edit box.
   Overlay text stays black on the whiteout, including dark mode. */
body.demo-mode .redaction-box { background: #fff !important; }
body.demo-mode .redaction-box[data-transparent="true"] { background: transparent !important; }
body.editor-active .redaction-box[data-transparent="true"] {
    background: rgba(147, 51, 234, 0.1) !important;
    border: 2px dashed #9333ea !important;
}
body.editor-active .redaction-box.selected[data-transparent="true"] {
    border-color: #ec4899 !important;
    border-style: solid !important;
    background: rgba(236, 72, 153, 0.2) !important;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.5) !important;
}
body.demo-mode .redaction-box,
body.demo-mode .redaction-text {
    color: #000 !important;
    text-shadow: none !important;
}
body.demo-mode .redaction-box[data-baked="1"] { display: none !important; }
body.demo-mode .redaction-box.redaction-logo {
    z-index: 16 !important;
    color: transparent !important;
    background-color: #fff !important;
    background-image: url('assets/cox-research-logo.svg?v=2.5.119') !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
}
body.demo-mode .redaction-box.redaction-logo .redaction-text { color: transparent !important; }
body.demo-mode .redaction-box.redaction-logo[data-logo-ground="dark"] {
    background-image: url('assets/cox-research-logo-on-dark.svg?v=2.5.119') !important;
}
.zone-field-tag { display: none; }
body.editor-active .zone-field-tag {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    padding: 0 2px;
    background: #fff;
    color: #334155;
    font-family: Inter, sans-serif;
    font-size: 8px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0;
    pointer-events: none;
}
.redaction-resize-handle { display: none; } 
body.editor-active .redaction-resize-handle { 
    display: block; 
    width: 12px; height: 12px; 
    background: var(--app-primary); 
    border: 1px solid white; 
    position: absolute; bottom: -6px; right: -6px; 
    cursor: nwse-resize !important; pointer-events: auto;
}
.pdf-page-wrapper[data-panel-mapped="1"] .page-profile-select { display: none; }

#generator-panel {
    position: fixed; 
    top: 90px; 
    right: 20px;
    width: 295px;
    max-height: calc(100vh - 110px); 
    display: flex;
    flex-direction: column;
    background: var(--bg-card); 
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 2000;
    backdrop-filter: blur(10px);
    transition: opacity 0.2s, transform 0.2s;
}

#generator-panel.minimized {
    opacity: 0; 
    pointer-events: none; 
    transform: translateY(20px);
}

#generator-panel .panel-sidebar-header {
    background: var(--bg-controls);
    color: var(--text-primary);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#generator-panel .editor-title { color: var(--text-primary) !important; font-size: 12px; font-weight: 700; text-transform: none; letter-spacing: 0; }

#redaction-editor-content {
    padding: 10px;
    padding-bottom: 20px;
    overflow-y: auto;
    flex: 1; 
    width: 100%; 
}

#generator-restore-btn {
    position: absolute;
    top: 90px; right: 20px;
    width: 50px; height: 50px;
    border-radius: 50%;
    background: var(--app-primary);
    color: white;
    font-size: 24px;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 2000;
    display: none; 
    align-items: center; justify-content: center;
    transition: transform 0.2s;
}
#generator-restore-btn:hover { transform: scale(1.1); }

/* Minimize control for the compact (floating) Field Editor; docked layouts use the rail instead */
#generator-minimize-btn {
    display: none;
    margin-left: auto;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.editor-section { margin-bottom: 10px; } 
.editor-label { font-size: 10px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text-secondary); display: block; margin-bottom: 5px; } 
.disabled-overlay { opacity: 0.5; pointer-events: none; } 
.demo-label { font-size: 10px; font-weight: 800; color: var(--app-primary); text-transform: none; letter-spacing: 0; margin-bottom: 2px; } 
.demo-input { width: 100%; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--demo-border); border-radius: 4px; font-size: 12px; background: var(--bg-input); color: var(--text-primary); outline: none; }
input[type="date"].demo-input { text-align: left; }

.input-wrapper {
    /* Wrapper for input fields to enable show/hide */
    display: block;
    min-width: 0;
}

#pdf-viewer-frame { width: 100%; height: 100%; border: none; background: #fff; display: none; } 
#pdf-fallback { display: none; text-align: center; color: white; padding: 20px; width: 100%; align-self: center; } 

#pdf-placeholder-text { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: absolute;
    inset: 0;
    height: 100%; 
    width: 100%; 
    z-index: 2;
    pointer-events: none;
    color: rgba(255,255,255,0.5); 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-size: 1.2em; 
}

.alignment-toggles { display: flex; gap: 5px; }
.align-btn {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px;
    border-radius: 4px;
    font-size: 12px;
}
.align-btn:hover { background: var(--bg-sidebar); }

@media (max-width: 767px) {
    #app-container {
        flex-direction: column;
        height: calc(var(--app-viewport-height) - var(--header-base-height));
        min-height: 0;
    }
    #sidebar-left { display: contents; }
    #search-controls {
        order: 1;
        width: 100%;
        border-bottom: 1px solid var(--surface-soft-border);
        border-right: none;
        z-index: 30;
        background: var(--bg-sidebar);
        flex-shrink: 0;
        padding: 5px 6px;
        gap: 4px;
        box-shadow: var(--surface-soft-shadow);
    }
    #search-main-fields {
        display: flex;
        flex-direction: column;
        gap: 3px;
    }
    #search-controls .filter-grid {
        gap: 3px;
    }
    #search-controls .input-group {
        gap: 0;
    }
    #search-controls .cox-input {
        height: 32px;
        font-size: 11px;
        padding: 0 7px;
    }
    #search-controls .keyword-blocklist-toggle {
        height: 32px;
        width: 32px;
        min-width: 32px;
    }
    #search-action-row {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto;
        margin-top: 5px !important;
        gap: 6px !important;
        align-items: center;
        border-radius: 0;
        padding: 3px 0 0;
        border-top: 1px solid var(--surface-soft-border);
        background: transparent;
        box-shadow: none;
    }
    #search-action-row .panel-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 74px;
        min-height: 34px;
        padding: 0 10px;
        font-size: 9px;
        letter-spacing: 0.35px;
    }
    #search-action-row #searchBtn {
        width: 100%;
        min-width: 0;
    }
    #search-action-row .reset-btn {
        width: 34px;
        min-width: 34px;
    }
    #refine-btn-area {
        display: inline-flex;
        z-index: 31;
    }
    #preview-pane { order: 2; flex: 1; width: 100%; height: auto; border-left: none; }
    #pdf-toolbar {
        justify-content: flex-start;
        align-content: center;
        gap: 4px;
        padding: 5px 6px;
        flex-wrap: nowrap;
    }
    #pdf-toolbar .pdf-tool-btn {
        height: 30px;
        padding: 0 4px;
        gap: 4px;
        font-size: 10px;
    }
    #pdf-toolbar .pdf-maintain-position-btn {
        width: auto;
        justify-content: center;
        padding: 0 5px;
        gap: 3px;
    }
    #pdf-toolbar .pdf-tool-btn-icon {
        font-size: 12px;
    }
    #pdf-toolbar .maintain-lock-icon,
    #pdf-toolbar .maintain-lock-icon svg {
        width: 12px;
        height: 12px;
    }
    #pdf-toolbar .pdf-download-control {
        max-width: 100%;
    }
    #pdf-toolbar .pdf-toolbar-hint {
        max-width: min(220px, calc(100vw - 32px));
    }
    #results-scroll-area {
        order: 3;
        width: 100%;
        display: none;
        max-height: 42vh;
        max-height: 42svh;
        max-height: 42dvh;
        padding: 4px 6px 0;
        border-top: 1px solid var(--surface-soft-border);
        border-right: none;
        background: var(--bg-sidebar);
        z-index: 20;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
        flex-shrink: 0;
        gap: 4px;
    }
    #results-header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        min-height: 30px;
        gap: 6px;
    }
    #results-toggle-btn {
        display: inline-flex;
        min-height: 30px;
        padding: 0 9px;
        font-size: 9px;
        letter-spacing: 0.35px;
        justify-self: start;
    }
    #results-count {
        font-size: 9px;
        letter-spacing: 0.5px;
        line-height: 1.2;
        margin-left: auto;
        text-align: right;
        justify-self: end;
    }
    #results-list {
        overflow-y: auto;
    }
    #results-area {
        gap: 3px;
    }
    #pagination-footer {
        order: 4;
        width: 100%;
        margin-top: auto;
        padding: 4px 0 max(6px, env(safe-area-inset-bottom));
        border-top: 1px solid var(--surface-soft-border);
        background: var(--bg-card);
        justify-content: center;
        gap: 8px;
        flex-shrink: 0;
    }
    #pagination-footer .page-btn {
        min-height: 30px;
        padding: 4px 9px;
        font-size: 10px;
    }
    #pagination-footer .page-info {
        font-size: 10px;
        white-space: nowrap;
    }
    #toggle-left { display: none; }
    /* v2.5.100: compact Submittal Generator for eligible < 768 px viewports (small phones are
       excluded by the dedicated media query below). Floating panel + restore button, no rail. */
    #toggle-right { display: none !important; }
    #generator-panel {
        right: 12px;
        width: min(295px, calc(100vw - 24px));
        max-height: calc(var(--app-viewport-height) - 110px);
    }
    #generator-restore-btn { right: 12px; }
    #generator-minimize-btn { display: inline-flex; }
    #left-generator-context {
        order: 4;
        flex: 0 1 auto;
        width: 100%;
        min-height: 0;
        max-height: 28vh;
        max-height: 28dvh;
    }

    body.mobile-search-hidden #search-main-fields {
        display: none;
    }
    body.mobile-search-hidden #search-controls {
        padding-top: 4px;
        padding-bottom: 4px;
        gap: 0;
    }
    body.mobile-results-available #results-scroll-area {
        display: flex;
    }
    body.mobile-results-available.mobile-results-hidden #results-scroll-area {
        max-height: 40px;
        min-height: 40px;
        padding-bottom: 0;
        box-shadow: none;
    }
    body.mobile-results-hidden #results-list {
        display: none;
    }
    body.mobile-results-hidden #pagination-footer {
        display: none !important;
    }
    body.mobile-results-available:not(.mobile-results-hidden) #results-scroll-area {
        min-height: clamp(188px, 36dvh, 250px);
    }
    .record-card {
        padding: 5px 6px;
        gap: 3px;
    }
    .panel-name {
        font-size: 13px;
    }
    .badge-row {
        gap: 3px;
        margin-bottom: 1px;
    }
    .hud-badge {
        font-size: 8.5px;
        padding: 2px 5px;
    }
    .logo-sub-row {
        gap: 4px;
        margin-top: 2px;
    }
    .app-title-main {
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 1.6px;
    }
    .logo-main { font-size: 1.58rem; } 
    .logo-sub { font-size: 0.7rem; letter-spacing: 2px; }
    #pdf-toolbar .pdf-maintain-position-btn .pdf-tool-btn-label {
        font-size: 10px;
        letter-spacing: 0.1px;
    }
    #pdf-zoom-level {
        min-width: 34px;
        font-size: 12px;
    }
}

/* v2.5.100: Submittal Generator unavailable ONLY on small phones (short side <= 430 px while in the
   < 768 px mobile layout). Must stay identical to DemoManager.SMALL_DEVICE_MEDIA_QUERY in app.js. */
@media (max-width: 430px), (max-width: 767px) and (max-height: 430px) {
    #menu-demo,
    #generator-panel,
    #generator-restore-btn,
    #toggle-right,
    #left-generator-context { display: none !important; }
}

/* Eligible compact generator range (complement of the query above within < 768 px): keep part of the
   PDF visible while the context block shrinks and scrolls on short viewports */
@media (min-width: 431px) and (max-width: 767px) and (min-height: 431px) {
    body.demo-mode #preview-pane { min-height: 30%; }
}

@media (max-width: 360px) {
    #pdf-toolbar {
        gap: 3px;
        padding: 4px;
    }
    #pdf-toolbar .pdf-tool-btn {
        padding: 0 3px;
        font-size: 9px;
    }
    #pdf-toolbar .pdf-tool-btn-icon {
        font-size: 11px;
    }
    #pdf-toolbar .pdf-maintain-position-btn {
        padding: 0 4px;
    }
    #pdf-toolbar .pdf-maintain-position-btn .pdf-tool-btn-label {
        font-size: 9px;
    }
    #pdf-zoom-level {
        min-width: 30px;
        font-size: 11px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    #sidebar-left {
        width: calc(var(--sidebar-width) * 0.92);
        min-width: 230px;
    }
}

@media (min-width: 768px) {
    #menu-demo { display: flex; }
    .brand-lockup {
        padding-bottom: 2px;
        padding-right: clamp(114px, 15vw, 156px);
        max-width: calc(100% - 58px);
    }
    .logo-group {
        position: relative;
    }
    .logo-main {
        font-size: clamp(2.2rem, 2.75vw, 2.55rem);
        letter-spacing: -1.1px;
    }
    .logo-sub-row {
        gap: clamp(5px, 0.7vw, 8px);
        margin-top: 2px;
    }
    .logo-sub {
        font-size: clamp(0.66rem, 0.85vw, 0.76rem);
        letter-spacing: 3.4px;
        font-weight: 800;
    }
    .app-title-main {
        font-size: clamp(0.66rem, 0.85vw, 0.76rem);
        font-weight: 800;
        letter-spacing: 3.4px;
    }
}

@media (min-width: 768px) {
    body.mobile-search-hidden #search-controls {
        display: flex !important;
        padding: 6px 7px;
        gap: 4px;
    }

    body.mobile-search-hidden #search-main-fields {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
    }

    body.mobile-results-available #results-scroll-area,
    body.mobile-results-hidden #results-scroll-area,
    body.mobile-results-available.mobile-results-hidden #results-scroll-area {
        display: flex !important;
        min-height: 0;
        max-height: none;
        padding: 5px;
        gap: 5px;
        box-shadow: var(--surface-soft-shadow);
    }

    body.mobile-results-hidden #results-list {
        display: block !important;
    }

    /* 3-column flex layout: left sidebar | viewer | generator sidebar (tablet + desktop) */
    #generator-panel {
        position: static;
        width: 260px;
        min-width: 260px;
        max-height: none;
        height: 100%;
        top: auto;
        right: auto;
        border-radius: 0;
        border-left: 1px solid var(--surface-soft-border);
        border-top: none;
        border-right: none;
        border-bottom: none;
        box-shadow: none;
        overflow-y: auto;
        z-index: 20;
        flex-shrink: 0;
        transition: width 0.3s ease, min-width 0.3s ease;
    }
    #generator-panel.gen-collapsed {
        width: 0;
        min-width: 0;
        border: none;
        overflow: hidden;
    }
    #generator-panel.gen-collapsed #customer-info-box,
    #generator-panel.minimized #customer-info-box {
        display: none !important;
    }
    /* Restore btn not used on tablet */
    #generator-restore-btn { display: none !important; }

    #search-controls {
        padding: 6px 7px;
        gap: 4px;
    }

    #search-controls.collapsed {
        max-height: none;
        padding: 6px 7px;
        gap: 0;
        opacity: 1;
        border-bottom: 1px solid var(--surface-soft-border);
    }

    #search-controls.collapsed #search-main-fields {
        display: none;
    }

    #search-controls.collapsed #search-action-row {
        margin-top: 0 !important;
        padding-top: 0;
        border-top: none;
    }

    #search-action-row {
        padding-top: 3px;
    }

    #results-scroll-area {
        padding: 5px;
        gap: 5px;
        border-radius: 8px 8px 0 0;
    }

    #pagination-footer {
        padding: 6px;
        border-radius: 8px 8px 0 0;
    }
}

/* Tab Navigation Styles */
.tab-navigation {
    display: flex;
    border-bottom: 2px solid var(--app-primary);
    margin-bottom: 0;
    background: var(--bg-controls);
    border-radius: 0;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-controls);
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 11px;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn:hover {
    background: rgba(147, 51, 234, 0.1);
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--app-primary);
    border-bottom-color: var(--app-primary);
    background: rgba(147, 51, 234, 0.05);
}

.tab-content {
    padding: 0;
}

.toggle-item {
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.toggle-item:hover {
    background: rgba(147, 51, 234, 0.05);
}

.toggle-item input[type="checkbox"] {
    cursor: pointer;
}

/* Zone-action icon buttons: compact plus and minus at every width. */
.add-zone-btn,
.del-zone-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: #f1f5f9;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.add-zone-btn:hover {
    background: var(--match-green-bg);
    border-color: var(--match-green-bg);
    color: white;
}
.del-zone-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}
body.dark-mode .add-zone-btn,
body.dark-mode .del-zone-btn {
    background: #2a2a2a;
    color: #cbd5e1;
}

/* Zone Styling accordion */
.zone-styling-header {
    user-select: none;
    -webkit-user-select: none;
}
#zone-styling-toggle-icon {
    display: inline-block;
    transition: transform 0.3s;
    min-width: 28px;
    text-align: center;
}
#zone-styling-panel.collapsed-state #zone-styling-toggle-icon {
    transform: rotate(-90deg);
}

/* ---------- v2.5.129: DWG text editor (Submittal Generator, manifest panels only) ---------- */
/* Layout uses flex, %, rem and clamp(); no fixed page sizes so the same markup works when the generator is enabled on phones. */
.dwg-mode-bar { display: flex; gap: 0; margin: 8px 10px 0; border: 1px solid var(--demo-border); border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.dwg-mode-bar[hidden] { display: none; }
.dwg-seg { flex: 1; min-height: 30px; border: none; background: var(--bg-input); color: var(--app-primary); font-size: 10px; font-weight: 800; letter-spacing: 0; text-transform: none; cursor: pointer; }
.dwg-seg + .dwg-seg { border-left: 1px solid var(--demo-border); }
.dwg-seg[aria-pressed="true"] { background: var(--app-primary); color: #fff; }
.dwg-seg:focus-visible, .dwg-btn:focus-visible, .dwg-unl:focus-visible { outline: 2px solid var(--lsu-gold); outline-offset: 1px; }

body.dwg-editor-on #generator-panel:not(.gen-collapsed):not(.minimized) { width: clamp(295px, 30vw, 400px); overflow: hidden; }
body.dwg-editor-on #generator-panel.gen-collapsed { width: 0; min-width: 0; overflow: hidden; }
body.dwg-editor-on #redaction-editor-content { display: none; }
body.dwg-blank-mode #redaction-editor-content { display: block; }
body.dwg-editor-on #custom-pdf-viewer,
body.dwg-editor-on #pdf-viewer-frame,
body.dwg-editor-on #pdf-fallback,
body.dwg-editor-on #pdf-placeholder-text { display: none !important; }

#dwg-editor-side { padding: 10px; padding-bottom: 20px; overflow-y: auto; flex: 1; min-height: 0; }
#dwg-editor-side[hidden], #dwg-editor-view[hidden] { display: none; }
.dwg-fold { margin: 8px 0; }
.dwg-fold > summary { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.dwg-fold > summary::-webkit-details-marker { display: none; }
.dwg-caret {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    flex: 0 0 auto;
}
.dwg-fold[open] > summary .dwg-caret,
.dwg-fold-toggle[aria-expanded="true"] .dwg-caret { transform: rotate(45deg); }
.dwg-fold-toggle {
    width: 100%;
    margin: 12px 0 6px;
    padding: 0 0 4px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: none;
    color: inherit;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.dwg-fold-body[hidden] { display: none !important; }
.dwg-fold-hint { font-size: 10px; font-weight: 500; color: var(--text-secondary); }
.dwg-attn { margin-left: auto; min-width: 1.1rem; padding: 0 5px; border-radius: 8px; background: var(--match-orange-bg); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
.dwg-attn[hidden] { display: none; }
#dwg-selinp:disabled { opacity: 0.75; }
.dwg-group { font-size: 11px; font-weight: 600; color: var(--text-primary); margin: 12px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border-color); }
.dwg-group--warn { color: var(--match-orange-bg); }
.dwg-fld { margin-bottom: 8px; padding-left: 6px; border-left: 3px solid transparent; }
.dwg-fld .demo-label { display: block; }
.dwg-row { display: flex; gap: 4px; align-items: center; }
.dwg-fld.is-edited { border-left-color: var(--lsu-gold); }
.dwg-fld.is-edited .demo-input { background: #fff8d6; }
.dwg-fld.is-bad .demo-input, #dwg-selinp.is-bad { background: #fee2e2; border: 2px solid var(--match-red-bg); }
.dwg-fld.is-bad .demo-label { color: var(--match-red-bg); }
.dwg-spots { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }
.dwg-spots summary { cursor: pointer; }
.dwg-spots ul { margin: 4px 0 0; padding-left: 16px; }
.dwg-spots li { cursor: pointer; padding: 1px 0; }
.dwg-spots li:hover, .dwg-spots li:focus { text-decoration: underline; color: var(--app-primary); }
.dwg-btn { min-height: 28px; padding: 0 10px; border: 1px solid var(--border-color); border-radius: 4px; background: var(--bg-input); color: var(--text-primary); font-size: 11px; font-weight: 600; cursor: pointer; }
.dwg-btn:hover { border-color: var(--app-primary); color: var(--app-primary); }
.dwg-btn--icon { min-width: 30px; padding: 0 6px; flex-shrink: 0; }
.dwg-btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dwg-btnrow .search-btn { flex: 1 1 auto; }
.dwg-link { border: none; background: none; padding: 2px 0; color: var(--app-primary); font-size: 10px; text-decoration: underline; cursor: pointer; }
.dwg-hint, .dwg-small { font-size: 10px; line-height: 1.4; color: var(--text-secondary); margin: 4px 0; }
.dwg-orig { font-family: 'Roboto Mono', monospace; font-size: 11px; background: var(--bg-sidebar); border: 1px solid var(--border-color); border-radius: 4px; padding: 4px 6px; margin: 4px 0 6px; white-space: pre-wrap; word-break: break-word; }
.dwg-warn { font-size: 11px; color: var(--match-orange-bg); margin: 4px 0; white-space: pre-line; }
.dwg-unl { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px dotted var(--border-color); background: none; padding: 4px 0; font-size: 11px; color: var(--match-orange-bg); cursor: pointer; }
.dwg-ed { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11px; padding: 4px 0; border-bottom: 1px solid var(--border-color); cursor: pointer; }
.dwg-ed .dwg-btn { margin-left: auto; }
.dwg-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.dwg-actions .search-btn { width: 100%; height: auto; min-height: 34px; padding: 8px; }
.dwg-actions .search-btn:disabled { background: var(--match-red-bg) !important; opacity: 0.6; cursor: not-allowed; }
.dwg-check { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--text-primary); cursor: pointer; }
.dwg-expwarn { font-size: 11px; color: var(--match-red-bg); }
.dwg-expwarn[hidden] { display: none; }
.dwg-notice { font-size: 11px; line-height: 1.4; padding: 8px; margin-bottom: 8px; border: 1px solid var(--demo-border); border-radius: 4px; background: var(--demo-bg); color: var(--text-primary); }
.dwg-notice[hidden] { display: none; }
.dwg-notice--flag { border-color: var(--match-orange-bg); background: #fff7ed; color: #9a3412; margin: 4px 0 0; }
.dwg-notice--error { border-color: var(--match-red-bg); background: #fef2f2; color: #991b1b; }
.dwg-engineer-label { margin: 0 0 8px; padding: 6px 8px; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; color: #fff; background: var(--app-primary); }
.dwg-eng-audit { margin: 0 0 10px; padding: 8px; border: 1px solid var(--demo-border); border-radius: 4px; background: var(--demo-bg); }
.dwg-engineer-last { margin: 0 0 6px; font-size: 12px; font-weight: 600; }
.engineer-unlock { position: fixed; inset: 0; z-index: 12000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); }
.engineer-unlock[hidden] { display: none; }
.engineer-unlock-card { width: min(360px, calc(100% - 32px)); padding: 16px; background: var(--bg-app); color: var(--text-primary); border-radius: 6px; }
#dwg-fallback-banner { flex-shrink: 0; margin: 8px; }
#dwg-fallback-banner[hidden] { display: none; }

#dwg-editor-view { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg-viewer); }
.dwg-zoom { position: absolute; top: 8px; right: 8px; z-index: 3; display: flex; gap: 4px; }
.dwg-viewport { flex: 1; min-height: 0; overflow: hidden; position: relative; touch-action: none; }
.dwg-scroll { position: absolute; top: 0.4rem; bottom: 0.4rem; right: 0.2rem; width: 1.15rem; margin: 0; z-index: 5; writing-mode: vertical-lr; direction: rtl; accent-color: var(--text-secondary, #444); }
.dwg-scroll[hidden] { display: none !important; }
.dwg-engineer-missing { margin: 2rem 1.5rem; padding: 1rem 1.1rem; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary); font-weight: 700; }
.dwg-logo-fill { stroke: none; }
.dwg-stage { transform-origin: 0 0; width: max-content; max-width: none; margin: 0 auto; padding: 1rem 0; }
.dwg-preview { display: block; width: min(1000px, calc(100% - 2.5rem)); margin: 1rem auto; height: auto; }
.dwg-preview[hidden] { display: none; }
.dwg-pg { margin: 0 auto 1.1rem; }
.dwg-pl { color: #fff; font-size: 11px; font-weight: 600; margin-bottom: 3px; }
.dwg-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600; background: rgba(15, 23, 42, 0.35); }
.dwg-loading[hidden] { display: none; }
svg.dwg-sheet { background: #fff; display: block; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.dwg-sheet-pending { display: flex; align-items: center; justify-content: center; width: auto; min-height: 4rem; margin: 0 0 1.1rem; color: #fff; background: rgba(15, 23, 42, 0.25); }
/* Original text colour: drawing text is black on the sheet and in the export. */
.dwg-tx { fill: #000; white-space: pre; }
.dwg-hl { fill: transparent; stroke: transparent; stroke-width: 0.5; }
g.dwg-it.doc:hover .dwg-hl, g.dwg-it.unl:hover .dwg-hl { stroke: #15803d; }
g.dwg-it.job .dwg-hl { stroke: rgba(220, 38, 38, 0.65); stroke-dasharray: 1 1; }
g.dwg-it.unl .dwg-hl { stroke: #ea580c; stroke-dasharray: 2 1; }
.dwg-hl.edited { fill: var(--lsu-gold); fill-opacity: 0.55; }
.dwg-hl.bad { fill: #f00; fill-opacity: 0.35; stroke: #f00 !important; stroke-dasharray: none !important; }
.dwg-hl.sel { stroke: var(--app-primary) !important; stroke-width: 1; stroke-dasharray: none !important; }
#dwg-editor-view.is-preview .dwg-hl { display: none; }
g.dwg-it:not(.locked) { cursor: pointer; touch-action: manipulation; }

.dwg-modal { position: fixed; inset: 0; z-index: 10001; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(0, 0, 0, 0.55); }
.dwg-modal[hidden] { display: none; }
.dwg-modal-card { width: min(700px, 100%); max-height: 85vh; overflow: auto; background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); padding: 0 14px 14px; }
.dwg-modal-head { display: flex; align-items: center; justify-content: space-between; margin: 0 -14px 10px; padding: 10px 14px; background: var(--lsu-purple); color: #fff; font-size: 12px; font-weight: 800; text-transform: none; letter-spacing: 0; border-radius: 8px 8px 0 0; }
.dwg-modal-head .dwg-btn { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.3); }
.dwg-table { border-collapse: collapse; width: 100%; font-size: 11px; }
.dwg-table th, .dwg-table td { border: 1px solid var(--border-color); padding: 3px 6px; text-align: left; word-break: break-word; }
.dwg-ack { display: flex; align-items: center; gap: 6px; font-size: 11px; margin-top: 6px; }

@media (max-width: 767px) {
    body.dwg-editor-on #generator-panel:not(.gen-collapsed):not(.minimized) { width: min(100%, 26rem); }
}
body.dark-mode .dwg-fld.is-edited .demo-input { background: rgba(253, 208, 35, 0.18); }
body.dark-mode .dwg-notice--error { background: rgba(220, 38, 38, 0.15); color: #fecaca; }


/* v2.5.143 phone redesign.
   html.phone-ux is added unless localStorage cox_feature_phone_ux is "0".
   Title Case labels below apply at every width. Two-tap Field Editor behavior is in JS
   and also follows the flag at every width, including a mouse.
   The layout block is phone widths only (max-width: 767px, under 768px). Tablet and desktop keep
   the existing geometry. The small-phone generator unhide stays on the v2.5.100 query,
   which does not match an 820px tablet or a 1280px desktop. */
html.phone-ux {
    --ux-ease: cubic-bezier(.32, .72, 0, 1);
    --ux-enter: cubic-bezier(0, 0, .2, 1);
    --ux-exit: cubic-bezier(.4, 0, 1, 1);
    --ux-tap: 150ms;
    --ux-panel: 350ms;
    --ux-sheet: 500ms;
    --ux-sheet-out: 400ms;
    --ux-fade: 200ms;
    --ux-hairline: rgba(70, 29, 124, .18);
    --ux-lavender: #ede9f6;
}
html.phone-ux body.dark-mode {
    --ux-hairline: rgba(235, 235, 245, .22);
    --ux-lavender: #3b3450;
}
/* Title Case labels at every width. Badges and the brand lockup stay uppercase. */
html.phone-ux .panel-toggle-btn,
html.phone-ux .input-label,
html.phone-ux .editor-label,
html.phone-ux .demo-label,
html.phone-ux #generator-panel .editor-title,
html.phone-ux .menu-header,
html.phone-ux .feedback-label,
html.phone-ux .dwg-seg,
html.phone-ux .dwg-modal-head,
html.phone-ux #results-count,
html.phone-ux #pdf-preview-header span {
    text-transform: none;
    letter-spacing: 0;
}

@media (max-width: 767px) {
    html.phone-ux body {
        font-family: system-ui, -apple-system, "Helvetica Neue", sans-serif;
    }
    html.phone-ux body.dark-mode {
        text-shadow: none !important;
    }
    html.phone-ux body.dark-mode .cox-input::placeholder,
    html.phone-ux body.dark-mode .demo-input::placeholder {
        color: #d4d4d8;
    }

    html.phone-ux .menu-btn {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        transition: background-color var(--ux-tap) linear, border-color var(--ux-tap) linear, opacity var(--ux-tap) linear;
    }
    html.phone-ux .menu-dropdown {
        width: min(320px, calc(100vw - 24px));
        border-radius: 12px;
        animation: uxMenuIn var(--ux-tap) var(--ux-enter);
    }
    html.phone-ux .menu-item {
        min-height: 44px;
        padding: 0 16px;
        font-size: 15px;
        font-weight: 600;
    }
    html.phone-ux .menu-version {
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
        padding: 12px 16px 4px;
    }
    html.phone-ux .menu-header {
        text-transform: none;
        letter-spacing: 0;
        font-size: 13px;
        font-weight: 700;
        padding: 8px 16px;
    }

    html.phone-ux #search-controls {
        padding: 6px 10px 6px;
        gap: 4px;
        transition: opacity var(--ux-fade) var(--ux-enter), transform var(--ux-panel) var(--ux-ease);
    }
    html.phone-ux #search-controls .filter-grid {
        gap: 2px 6px;
    }
    html.phone-ux #search-controls .input-group {
        gap: 0;
    }
    html.phone-ux #search-controls .cox-input,
    html.phone-ux #search-controls .keyword-blocklist-toggle {
        height: 36px;
        min-height: 36px;
        font-size: 14px;
        border-radius: 8px;
    }
    html.phone-ux #search-controls .keyword-blocklist-toggle {
        width: 36px;
        min-width: 36px;
        border-radius: 0 8px 8px 0;
    }
    html.phone-ux #keywordInput {
        border-radius: 8px 0 0 8px;
    }
    html.phone-ux #search-controls .input-label {
        font-size: 11px;
        font-weight: 700;
        padding: 2px 0 0;
        line-height: 1.2;
    }
    html.phone-ux #search-action-row {
        gap: 6px !important;
        margin-top: 4px !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        align-items: center;
        border-top: none;
    }
    html.phone-ux body.mobile-search-hidden #search-controls {
        padding: 6px 10px;
        gap: 0;
    }
    html.phone-ux body.mobile-search-hidden #search-action-row {
        margin-top: 0 !important;
    }
    html.phone-ux #search-action-row .panel-toggle-btn,
    html.phone-ux #results-toggle-btn {
        min-height: 34px;
        height: 34px;
        padding: 0 12px;
        border-radius: 999px;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
        background: var(--ux-lavender);
        color: var(--app-primary);
        border: 1px solid var(--ux-hairline);
        box-shadow: inset 0 0 0 1px var(--ux-hairline);
        transition: background-color var(--ux-tap) linear, color var(--ux-tap) linear, opacity var(--ux-tap) linear;
    }
    html.phone-ux body.dark-mode #search-action-row .panel-toggle-btn,
    html.phone-ux body.dark-mode #results-toggle-btn {
        color: #d4c4f5;
    }
    html.phone-ux #search-action-row #searchBtn,
    html.phone-ux #pagination-footer .page-btn {
        min-height: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0;
        padding: 0 12px;
        transition: background-color var(--ux-tap) linear, opacity var(--ux-tap) linear;
    }
    html.phone-ux #search-action-row .reset-btn {
        width: 34px;
        min-width: 34px;
        height: 34px;
        border-radius: 10px;
    }
    html.phone-ux #results-count {
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
    }
    html.phone-ux #results-scroll-area {
        padding: 4px 0 0;
        background: var(--bg-app);
    }
    html.phone-ux #results-header {
        padding: 0 10px;
        min-height: 32px;
    }
    html.phone-ux #results-area {
        margin: 4px 8px 6px;
        background: var(--bg-card);
        border-radius: 10px;
        overflow: hidden;
        gap: 0;
        transition: opacity var(--ux-fade) var(--ux-enter);
    }
    html.phone-ux .record-card {
        min-height: 0;
        padding: 5px 20px 5px 8px;
        border-radius: 0;
        border: none;
        border-bottom: 0.5px solid var(--border-color);
        border-left: 4px solid var(--app-primary);
        box-shadow: none;
        gap: 2px;
        justify-content: center;
        transition: background-color var(--ux-tap) linear, opacity var(--ux-tap) linear;
    }
    html.phone-ux .record-card:last-child { border-bottom: none; }
    html.phone-ux .record-card:hover {
        transform: none;
        box-shadow: none;
    }
    html.phone-ux .record-card:not(.no-pdf-card)::after {
        content: "\203A";
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-secondary);
        font-size: 16px;
        font-weight: 500;
        line-height: 1;
    }
    html.phone-ux .record-card.no-pdf-card,
    html.phone-ux .record-card.no-pdf-card:hover {
        opacity: 1 !important;
        border-left-color: #9ca3af;
        cursor: not-allowed !important;
    }
    html.phone-ux .record-card.no-pdf-card .panel-name { color: #6b7280; }
    html.phone-ux body.dark-mode .record-card.no-pdf-card .panel-name { color: #a1a1aa; }
    html.phone-ux .panel-name { font-size: 14px; line-height: 1.15; }
    /* #c4b5fd on the dark card (#27272a) is 8.07:1. #5a2a99 on that card is about 1.6:1. */
    html.phone-ux body.dark-mode .record-card:not(.no-pdf-card) .panel-name { color: #c4b5fd; }
    html.phone-ux .hud-badge {
        display: inline-flex;
        align-items: center;
        height: 18px;
        padding: 0 7px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.55);
        font-size: 9px;
        font-weight: 800;
        letter-spacing: 0.3px;
        text-transform: uppercase;
        box-sizing: border-box;
        color: #ffffff;
        background-color: #4b5563;
        background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0, rgba(255, 255, 255, 0) 1px);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.5),
            0 1px 1px rgba(15, 23, 42, 0.16),
            0 4px 10px rgba(15, 23, 42, 0.18);
    }
    html.phone-ux .hud-badge.match-green,
    html.phone-ux .hud-badge.match-keyword {
        color: var(--match-green-text);
        background-color: var(--match-green-bg);
    }
    html.phone-ux .hud-badge.match-orange {
        color: var(--match-orange-text);
        background-color: var(--match-orange-bg);
        /* White on #ea580c is 3.56:1. A flat 16% black scrim keeps that fill and clears 4.5:1. */
        background-image:
            linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0, rgba(255, 255, 255, 0) 1px),
            linear-gradient(rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.16));
    }
    html.phone-ux .hud-badge.match-red {
        color: var(--match-red-text);
        background-color: var(--match-red-bg);
    }
    html.phone-ux .hud-badge.no-pdf {
        color: #991b1b;
        background-color: #fee2e2;
        border-color: #fecaca;
        background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0, rgba(255, 255, 255, 0) 1px);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.9),
            0 1px 1px rgba(153, 27, 27, 0.1),
            0 3px 8px rgba(153, 27, 27, 0.12);
    }
    html.phone-ux .hud-badge.unknown {
        color: #4b5563;
        background-color: #f3f4f6;
        border-color: #e5e7eb;
        background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0, rgba(255, 255, 255, 0) 1px);
    }
    html.phone-ux body.dark-mode .hud-badge {
        border-color: rgba(255, 255, 255, 0.4);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.4),
            0 1px 2px rgba(0, 0, 0, 0.4),
            0 6px 14px rgba(0, 0, 0, 0.35);
    }
    html.phone-ux body.dark-mode .hud-badge.no-pdf {
        color: #991b1b;
        background-color: #fee2e2;
        border-color: #fecaca;
    }
    html.phone-ux body.dark-mode .record-card.active-view:not(.no-pdf-card) {
        box-shadow: inset 0 0 0 1px #a78bfa;
    }
    html.phone-ux .record-card.active-view:not(.no-pdf-card) .panel-name { font-weight: 800; }

    html.phone-ux #pdf-toolbar {
        min-height: 0;
        min-width: 0;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
        gap: 2px;
        padding: 2px 3px;
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center;
        align-content: center;
        overflow: hidden;
        transition: opacity var(--ux-tap) linear;
    }
    html.phone-ux #pdf-toolbar .pdf-tool-btn {
        min-width: 34px;
        min-height: 34px;
        height: 34px;
        flex: 0 0 auto;
        box-sizing: border-box;
        padding: 0 4px;
        gap: 0;
        border-radius: 8px;
        font-size: 10px;
        font-weight: 600;
        transition: background-color var(--ux-tap) linear, color var(--ux-tap) linear, opacity var(--ux-tap) linear;
    }
    html.phone-ux #pdf-toolbar .pdf-tool-btn-icon { display: none; }
    html.phone-ux #pdf-toolbar .pdf-tool-btn-label { white-space: nowrap; }
    html.phone-ux #pdf-toolbar .pdf-maintain-position-btn .pdf-tool-btn-label {
        font-size: inherit;
        letter-spacing: 0;
    }
    html.phone-ux #pdf-toolbar .pdf-download-control { flex: 0 0 auto; max-width: none; }
    html.phone-ux #pdf-zoom-level { font-size: 10px; min-width: 30px; flex: 0 0 auto; text-align: center; }
    html.phone-ux body.mobile-results-available:not(.mobile-results-hidden) #results-scroll-area {
        min-height: 0;
        max-height: 32dvh;
    }
    html.phone-ux body.mobile-results-available.mobile-results-hidden #results-scroll-area {
        flex: 0 0 auto;
        max-height: none;
        min-height: 60px;
        height: auto;
        padding-top: 8px;
        padding-bottom: 8px;
        overflow: visible;
    }
    html.phone-ux .page-toolbar {
        min-height: 44px;
        gap: 8px;
    }
    html.phone-ux .page-toolbar .page-profile-select,
    html.phone-ux .page-toolbar select {
        min-height: 44px;
        border-radius: 10px;
        font-size: 15px;
    }

    html.phone-ux #generator-panel {
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        width: 100% !important;
        max-width: none;
        max-height: min(58dvh, calc(var(--app-viewport-height) - 280px));
        overflow: hidden;
        border-radius: 16px 16px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        transform: translateY(0);
        transition: transform var(--ux-sheet) var(--ux-ease), opacity var(--ux-fade) var(--ux-enter);
    }
    html.phone-ux #generator-panel.minimized {
        opacity: 0;
        transform: translateY(110%);
        transition: transform var(--ux-sheet-out) var(--ux-exit), opacity 160ms var(--ux-exit);
    }
    html.phone-ux body.dwg-editor-on #generator-panel:not(.minimized):not(.gen-collapsed) { width: 100% !important; }
    html.phone-ux #generator-panel .panel-sidebar-header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        padding: 2px 10px 4px;
    }
    html.phone-ux #generator-panel .panel-sidebar-header::before {
        content: "";
        grid-column: 1 / -1;
        justify-self: center;
        width: 36px;
        height: 4px;
        margin: 1px auto 2px;
        border-radius: 999px;
        background: var(--border-color);
    }
    html.phone-ux #generator-panel .editor-title {
        text-transform: none;
        letter-spacing: 0;
        font-size: 15px;
        flex: 1;
    }
    html.phone-ux #generator-minimize-btn,
    html.phone-ux #generator-restore-btn {
        min-width: 44px;
        min-height: 44px;
        transition: transform var(--ux-tap) var(--ux-enter), opacity var(--ux-tap) linear;
    }
    html.phone-ux #generator-restore-btn {
        top: auto;
        bottom: max(16px, env(safe-area-inset-bottom));
        right: 16px;
        width: auto;
        height: 44px;
        padding: 0 16px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 600;
    }
    html.phone-ux #customer-info-box .demo-input,
    html.phone-ux #zone-styling-content .cox-input,
    html.phone-ux #zone-styling-content .align-btn,
    html.phone-ux .dwg-fld .demo-input,
    html.phone-ux #dwg-selinp {
        min-height: 44px;
        border-radius: 10px;
        font-size: 16px;
    }
    html.phone-ux #zone-styling-content > .editor-section:first-child {
        flex-direction: column;
        align-items: stretch;
    }
    html.phone-ux .zone-styling-header { min-height: 44px; box-sizing: border-box; }
    html.phone-ux #zone-styling-content .editor-label { min-height: 44px; display: flex; align-items: center; }
    html.phone-ux #zone-bg-toggle { width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin-right: 8px; }
    html.phone-ux #redact-size { min-height: 44px; }
    html.phone-ux #custom-zone-text { min-height: 88px; }
    html.phone-ux .alignment-toggles { display: flex; gap: 8px; }
    html.phone-ux .alignment-toggles .align-btn { flex: 1 1 44px; min-width: 44px; min-height: 44px; }
    html.phone-ux #save-panel-profile,
    html.phone-ux #redaction-editor-content .search-btn {
        width: 100%;
        min-height: 44px;
        height: auto;
        border-radius: 12px;
        font-size: 15px;
        font-weight: 600;
        padding: 0 16px;
    }
    html.phone-ux .dwg-attn {
        padding: 0 8px;
        min-width: 1.4rem;
        line-height: 20px;
    }
    html.phone-ux #dwg-editor-side,
    html.phone-ux #redaction-editor-content {
        padding: 4px 8px 8px;
    }
    html.phone-ux .dwg-fold { margin: 4px 0; }
    html.phone-ux .dwg-caret { width: 10px; height: 10px; border-right-width: 2px; border-bottom-width: 2px; }
    html.phone-ux .dwg-fold-toggle { min-height: 44px; margin: 0; padding: 0 12px; border-bottom: none; font-size: 15px; }
    html.phone-ux .dwg-fold-hint { font-size: 12px; }
    html.phone-ux .dwg-mode-bar {
        margin: 4px 8px 0;
        padding: 2px;
        border: none;
        border-radius: 9px;
        background: var(--bg-input);
        box-shadow: inset 0 0 0 1px var(--ux-hairline);
    }
    html.phone-ux .dwg-seg {
        min-height: 44px;
        border-radius: 7px;
        border-left: none;
        background: transparent;
        color: var(--text-primary);
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
        transition: background-color var(--ux-tap) linear, color var(--ux-tap) linear;
    }
    html.phone-ux .dwg-seg[aria-pressed="true"] {
        background: #fff;
        color: #111827;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
    }
    html.phone-ux body.dark-mode .dwg-seg[aria-pressed="true"] {
        background: var(--bg-card);
        color: var(--text-primary);
    }
    html.phone-ux .dwg-fld {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        min-height: 44px;
        margin: 0;
        padding: 6px 8px;
        border-left: none;
        border-bottom: 0.5px solid var(--border-color);
    }
    html.phone-ux .dwg-fld .demo-label {
        flex: 0 0 118px;
        width: 118px;
        margin: 0;
    }
    html.phone-ux .dwg-row { flex: 1; min-width: 0; }
    html.phone-ux .dwg-fold {
        margin: 8px 0;
        background: var(--bg-card);
        border-radius: 12px;
        overflow: hidden;
    }
    html.phone-ux .dwg-group {
        min-height: 44px;
        margin: 0;
        padding: 0 12px;
        border-bottom: none;
        font-size: 15px;
        display: flex;
        align-items: center;
    }
    html.phone-ux .dwg-check {
        min-height: 44px;
        font-size: 15px;
    }
    html.phone-ux .dwg-check input[type="checkbox"] {
        appearance: none;
        width: 51px;
        height: 31px;
        margin: 0;
        border-radius: 999px;
        border: none;
        background: #e9e9eb;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
        position: relative;
        transition: background-color var(--ux-tap) linear;
    }
    html.phone-ux .dwg-check input[type="checkbox"]::before {
        content: "";
        position: absolute;
        top: 2px;
        left: 2px;
        width: 27px;
        height: 27px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
        transition: transform var(--ux-tap) var(--ux-ease);
    }
    html.phone-ux .dwg-check input[type="checkbox"]:checked {
        background: var(--app-primary);
    }
    html.phone-ux .dwg-check input[type="checkbox"]:checked::before {
        transform: translateX(20px);
    }
    html.phone-ux #zone-styling-toggle-icon {
        transition: transform var(--ux-tap) var(--ux-enter);
    }
    html.phone-ux #feedback-modal.active-modal,
    html.phone-ux .dwg-modal:not([hidden]) {
        align-items: flex-end;
        padding: 0;
        animation: uxScrimIn var(--ux-fade) var(--ux-enter);
    }
    html.phone-ux #feedback-modal.active-modal .modal-card,
    html.phone-ux .dwg-modal:not([hidden]) .dwg-modal-card {
        width: 100%;
        max-width: none;
        max-height: 85dvh;
        margin: 0;
        border-radius: 16px 16px 0 0;
        text-align: left;
        overflow: auto;
        animation: uxSheetIn var(--ux-sheet) var(--ux-ease);
    }
    html.phone-ux #pdf-preview-modal {
        animation: uxScrimIn var(--ux-fade) var(--ux-enter);
    }
}

@media (max-width: 430px), (max-width: 767px) and (max-height: 430px) {
    /* Thomas approved the Submittal Generator on phones when cox_feature_phone_ux is on.
       The live hide above still applies when the flag is off. */
    html.phone-ux #menu-demo { display: flex !important; }
    html.phone-ux body.demo-mode #generator-panel { display: flex !important; }
    html.phone-ux body.demo-mode.gen-minimized #generator-restore-btn { display: flex !important; }
    html.phone-ux body.demo-mode:not(.gen-minimized) #generator-restore-btn { display: none !important; }
}

@keyframes uxMenuIn {
    from { opacity: 0; transform: scale(.96); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes uxSheetIn {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes uxScrimIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    html.phone-ux, html.phone-ux * {
        animation-duration: 0s !important;
        animation-delay: 0s !important;
        transition-duration: 0s !important;
        scroll-behavior: auto !important;
    }
    html.phone-ux .menu-dropdown,
    html.phone-ux #results-area,
    html.phone-ux #feedback-modal.active-modal,
    html.phone-ux .dwg-modal:not([hidden]),
    html.phone-ux #pdf-preview-modal {
        transition-duration: 100ms !important;
        animation-duration: 100ms !important;
    }
}

.pdf-cad-toolset-wrap { position: relative; display: inline-flex; align-items: center; }
.pdf-cad-toolset-wrap[hidden] { display: none; }
#pdf-cad-toolset.is-disabled { opacity: 0.55; }
#pdf-cad-toolset[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--lsu-gold, #FDD023); }
.pdf-cad-toolset-wrap .pdf-toolbar-hint { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; width: max-content; max-width: 240px; }

.cad-toolbar {
    position: absolute;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: 292px;
    max-width: calc(100% - 12px);
    max-height: calc(100% - 16px);
    overflow: hidden;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #1e293b);
    border: 1px solid var(--border-color, #b6c1d0);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
    user-select: none;
    touch-action: none;
}
.cad-toolbar[hidden] { display: none; }
.cad-toolbar-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 36px;
    padding: 4px 6px 4px 12px;
    cursor: grab;
    background: var(--lsu-purple, #461D7C);
    color: #fff;
    border-radius: 12px 12px 0 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.cad-toolbar.is-collapsed { width: auto; }
.cad-toolbar.is-collapsed .cad-toolbar-handle { border-radius: 12px; }
.cad-toolbar.is-collapsed .cad-toolbar-body { display: none; }
.cad-icon-btn, .cad-tools button, .cad-row button {
    min-height: 32px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    color: inherit;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    padding: 0 8px;
}
.cad-icon-btn { width: 32px; color: #fff; }
.cad-toolbar-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.cad-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.cad-tools button {
    background: var(--bg-sidebar, #edf2f7);
    color: var(--text-primary, #1e293b);
    border-color: var(--border-color, #b6c1d0);
}
.cad-tools button[aria-pressed="true"] { background: var(--lsu-purple, #461D7C); color: #fff; border-color: var(--lsu-purple, #461D7C); }
.cad-props, .cad-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; }
.cad-prop { display: flex; flex-direction: column; gap: 2px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary, #64748b); min-width: 0; }
.cad-prop select, .cad-prop input, .cad-row input, .cad-attribs input {
    min-height: 32px;
    border: 1px solid var(--border-color, #b6c1d0);
    border-radius: 8px;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #1e293b);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    padding: 0 6px;
}
.cad-prop input[type="color"] { width: 42px; padding: 2px; }
.cad-row input { flex: 1; min-width: 96px; }
.cad-row button { background: var(--bg-sidebar, #edf2f7); color: var(--text-primary, #1e293b); border-color: var(--border-color, #b6c1d0); }
.cad-row button[aria-pressed="true"] { background: var(--lsu-gold, #FDD023); color: #1e293b; border-color: #e2b200; }
.cad-prompt { margin: 0; font-size: 12px; line-height: 1.35; color: var(--text-secondary, #64748b); }
.cad-attribs { display: flex; flex-direction: column; gap: 4px; }
body.dark-mode .cad-toolbar { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
