/* Modern Design System for ClientMail */
:root {
    /* Colors - Indigo/Slate Theme */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --bg-panel: #f9fafb;
    
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    
    --border-color: #e5e7eb;
    --border-focus: #6366f1;
    
    /* Spacing & Layout */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { font-size: 13px; }

/* 1. Global Reset & Typography */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.2;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
}

a {
    color: var(--primary);
    transition: color 0.2s;
}

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

/* 2. Layout Container */
#Page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    min-height: 100vh;
}

#MainContent {
    background-color: var(--bg-surface);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* Remove legacy debug borders */
#Header, #MainContent {
    border: none;
}

/* 3. Header & Navigation */
#Header {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0;
    padding: 0;
    height: auto;
}

#Header hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 0.25rem 0 0;
    width: 100%;
}

/* Top Menu / Navigation */
#navigation {
    display: flex;
    gap: 0;
    padding: 0;
    margin: 0 0 1rem 0;
    list-style: none;
    position: relative; /* for underline pseudo */
    border-bottom: none; /* underline drawn with pseudo-element */
    align-items: flex-end;
}

#navigation li {
    margin: 0;
    padding: 0;
    display: block;
}

/* Reset legacy tab sprites and floats */
#navigation a,
#navigation a span {
    background: none;
    float: none;
    text-decoration: none;
}

/* keep span internal padding cleared so anchor can control spacing */
/* #navigation a span cleaned up - no padding override so anchors control tab spacing */

#navigation a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: var(--text-muted); /* inactive text */
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, border-bottom-color 0s;
    border: 1px solid transparent; /* reserve space so borders don't shift text */
    border-bottom: 1px solid transparent;
    margin: 0;
    margin-bottom: -3px; /* overlap nav underline when active; increased to align */
    position: relative;
    z-index: 0;
    box-sizing: border-box;
    background-color: transparent;
}

/* draw the underline across the navigation using a pseudo element */
#navigation::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--border-color);
    pointer-events: none;
}

/* overlay pseudo element to hide the underline under the active tab */
#navigation a.active-tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px; /* cover the underline for -3px align */
    height: 6px; /* thicker to fully hide underline + border edge */
    background: var(--bg-surface); /* same as surface so it looks erased */
    border-radius: 0 0 4px 4px;
    pointer-events: none;
} 

#navigation a:hover {
    color: var(--primary);
    border-color: var(--border-color);
}

/* Active Tab Styling */
#navigation a.active-tab {
    color: var(--primary);
    border-color: var(--primary);
    border-bottom-color: transparent; /* remove underline under active */
    z-index: 3;
}

/* hide the underline and any portion of the vertical borders under the underline by overlaying a background strip
   this covers the 1px underline and any border-edge pixels from the active/hover tab without changing layout */
#navigation a:hover::after,
#navigation a.active-tab::after {
    content: "";
    position: absolute;
    left: -2px;
    right: -2px;
    bottom: -3px; /* reach below the underline for -3px margin */
    height: 6px; /* ensure it fully covers underline + border edge */
    background: var(--bg-surface);
    border-radius: 0 0 calc(var(--radius-md) + 2px) calc(var(--radius-md) + 2px);
    pointer-events: none;
    z-index: 4;
}

/* Fix for unreadable active tab label */
#navigation a span {
    color: inherit; /* Ensure span inherits link color */
}

/* Stats Area */
.top-menu-stats,
#topMenuPanel > div[style*="float:right"] {
    float: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.top-menu-stats span,
#topMenuPanel > div[style*="float:right"] span {
    color: var(--text-main);
    font-weight: 600;
    background-color: var(--primary-light);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
}

/* 4. Forms & Inputs */
input[type="text"], 
input[type="password"], 
textarea, 
select {
    appearance: none;
    background-color: #fff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md);
    padding: 0.35rem 0.55rem; /* Slightly increased padding for readability */
    font-size: 0.95rem; /* Slightly larger than body */
    line-height: 1.45;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    width: auto;
    max-width: 100%; /* Prevent overflow */
    cursor: pointer;
}

input[type="text"]:focus, 
input[type="password"]:focus, 
textarea:focus, 
select:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light) !important;
}

/* Add an explicit chevron so dropdown controls remain obvious with appearance reset */
select:not([multiple]):not([size]),
select[size="1"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 1.8rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.41 1.59 6 6.17l4.59-4.58L12 3l-6 5-6-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    background-size: 0.65rem auto;
}

/* Keep short status dropdowns readable when legacy inline widths are very narrow */
.servicesPanel select[id*="deletedFilter"] {
    min-width: 5.3rem;
    padding-right: 1.15rem;
    background-position: right 0.3rem center;
}

select::-ms-expand {
    display: none;
}

/* Buttons */
input[type="submit"], 
input[type="button"], 
button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.7rem; /* Increased padding for better tap targets */
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 12px; /* Slightly larger button text */
    line-height: 1.25; /* Improve centering */
    color: white;
    background-color: var(--primary);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: var(--shadow-sm);
    height: auto !important; /* Override fixed heights */
}

input[type="submit"]:hover, 
input[type="button"]:hover, 
button:hover {
    background-color: var(--primary-hover);
}

input[type="submit"]:active, 
input[type="button"]:active {
    transform: translateY(1px);
}

/* Compact Buttons ("...") */
input[value="..."] {
    padding: 0.1rem 0.5rem !important;
    min-width: auto !important;
    width: auto !important;
    height: auto !important;
    font-size: 0.9rem !important; /* Slightly larger compact action */
    background-color: var(--text-light) !important; /* Gray for secondary action */
}

input[value="..."]:hover {
    background-color: var(--text-muted) !important;
}

/* Ensure proxy "Check" button text is visible */
#proxyPanel input[id*="proxyClientButton"],
input[id*="proxyClientButton"] {
    width: auto;
    padding: 0.4rem 0.7rem !important;
    white-space: nowrap;
}

/* 5. Panels & Cards */
.tabsPanel, .servicesPanel, .panels, .managersPanel {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1rem !important; /* Reduced padding */
    margin-bottom: 1rem !important;
    width: 100% !important; /* Override fixed widths */
    max-width: 100% !important;
    box-sizing: border-box;
    height: auto !important; /* Force auto height */
}

.managersPanel {
    float: none !important;
    margin-left: 0 !important;
    display: block;
}

/* Override inline styles for panels */
.panels, #searchBox, #filterBox {
    height: auto !important;
    width: 100% !important;
    max-width: 100%;
}

/* Force containers to auto height */
div[style*="height:500px"], div[style*="height: 400px"] {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
}

table[style*="height:250px"], table[style*="height: 250px"] {
    height: auto !important;
}

.managersContent {
    overflow: visible !important;
    width: 100% !important;
}

.managersContent table {
    width: 100% !important;
}

/* Message Label (Yellow Box) */
.alert-box {
    background-color: #fef3c7 !important; /* Amber 100 */
    color: #92400e !important; /* Amber 800 */
    border: 1px solid #fcd34d !important; /* Amber 300 */
    border-radius: var(--radius-md);
    padding: 0.75rem !important;
    margin: 1rem 0 !important;
    font-weight: 500;
    display: block;
}

/* Hide if empty (requires no whitespace in HTML) */
.alert-box:empty {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* Search Header */
.panels strong[style*="font-variant: small-caps"] {
    font-variant: normal !important;
    text-transform: uppercase;
    font-size: 0.75rem !important;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.panels div[style*="border-bottom: solid 1px #aaaaaa"] {
    border-bottom: 1px solid var(--border-color) !important;
    margin-bottom: 0.5rem !important;
    padding-bottom: 0.25rem !important;
}

/* 6. Data Grids & Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto; /* Allow auto layout but constrain cells */
}

#gridViewTable, .gridview, .report-results-grid, .repeaterTable {
    width: 100%;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md);
    overflow: hidden;
    border-collapse: separate; /* Ensure radius works */
}

#gridViewTable th, .gridviewheader th, .report-results-grid th, .repeaterTable tr:first-child {
    background-color: #e5e7eb !important; /* Darker gray for contrast */
    color: var(--text-main) !important; /* Darker text for contrast */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 0.05em;    padding: 0.5rem 0.75rem 0.5rem 0.5rem !important; /* Top, Right, Bottom, Left */
    padding-left: 0.5rem !important; /* Ensure consistent left spacing for column headers */
    border-bottom: 1px solid var(--border-color) !important;
    border-right: none !important;
    border-left: none !important;
    border-top: none !important;
    text-align: left;
}

#gridViewTable td, .gridviewcell, .report-results-grid td, .repeaterTable td {
    padding: 0.5rem 0.75rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    border-right: none !important;
    border-left: none !important;
    border-top: none !important;
    color: var(--text-main);
    font-size: 1rem;
    background-color: white !important;
    word-wrap: break-word; /* Prevent overflow */
    max-width: 300px; /* Constrain wide columns */
}

#gridViewTable tr:last-child td, .repeaterTable tr:last-child td {
    border-bottom: none !important;
}

#gridViewTable tr:hover td, .repeaterTable tr:hover td {
    background-color: var(--bg-panel) !important;
}

/* Pagination Alignment */
#gridViewTable tr:last-child table td,
table[id*="clientGridView"] tr:last-child table td,
table[id*="clientListGridView"] tr:last-child table td {
    text-align: center !important;
    border: none !important;
    padding: 0.25rem 0.4rem !important;
}

#gridViewTable tr:last-child table,
table[id*="clientGridView"] tr:last-child table,
table[id*="clientListGridView"] tr:last-child table {
    margin: 0 auto !important;
    width: auto !important;
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}

#gridViewTable tr:last-child,
table[id*="clientGridView"] tr:last-child,
table[id*="clientListGridView"] tr:last-child {
    text-align: center !important;
}

/* Override inline styles for table rows */
tr[style*="background-color: #efefef"], tr[style*="background-color: #eeeeee"] {
    background-color: var(--bg-panel) !important;
}

/* Filter Box Specifics */
#filterBox td {
    padding: 0.25rem !important;
}

#filterBox span.bolded {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Fix background colors in filter box */
#filterBox td[style*="background-color: #eee"],
#filterBox td[style*="background-color: #ddd"],
#filterBox td[style*="background-color: #ccc"] {
    background-color: transparent !important;
    border-right: 1px solid var(--border-color);
}

#filterBox tr:nth-child(2) td {
    background-color: var(--bg-panel) !important;
    border-bottom: 1px solid var(--border-color);
}

/* Search & Filter Boxes */
#searchBox, #filterBox {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md);
    padding: 1rem;
    height: auto !important;
    width: 100% !important;
    max-width: 100%;
    margin-bottom: 1rem;
}

/* Utility Classes */
.bolded { font-weight: 600; }
.right { text-align: right; }
.left { text-align: left; }
.center { text-align: center; }

/* Align checkboxes and labels vertically */
input[type="checkbox"], input[type="radio"] {
    vertical-align: middle;
    margin: 0 0.35rem 1px 0; /* top right bottom left */
}

label[for], .gridviewcell label, .panels label, .managersPanel label, #filterBox label {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* Ensure checkboxes in grid cells align nicely with text */
.gridviewcell input[type="checkbox"], .repeaterTable input[type="checkbox"] {
    vertical-align: middle;
    margin-top: 0;
    margin-bottom: 1px;
}

/* Fix for specific inline styles that might conflict */
span[style*="color: Blue"] {
    color: var(--primary) !important;
}

/* Calendar Control Modernization */
.calTitle {
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.notes-wrap {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.app-header {
    border: none;
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.app-logo-button img {
    height: auto;
}

.app-header-meta {
    margin-left: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8rem;
    white-space: nowrap;
}

.app-today {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.app-header-rule {
    flex-basis: 100%;
    border: 0;
    border-top: 1px solid var(--border-color);
    width: 100%;
    margin-top: 0;
    padding: 0;
}

.top-menu-panel {
    margin: 0;
}

.app-stats {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: none;
    margin-bottom: 0;
    padding: 0;
    font-size: 0.82rem;
    gap: 0.65rem;
    white-space: nowrap;
}

.app-stats span {
    color: var(--text-main);
}

.top-menu-signout {
    margin-left: 0.5rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.1;
}

.notes-last-note-row,
.notes-toggle-row {
    margin-bottom: 6px;
    display: block;
    width: 100%;
}

.notes-editor-panel {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
}

.notes-editor-inner {
    border: 1px solid var(--border-color);
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
}

.notes-editor-input-row {
    margin-bottom: 6px;
}

.notes-editor-actions {
    margin-top: 6px;
}

.notes-save-message {
    margin-left: 8px;
}

.notes-history-wrap {
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.client-manager-shell {
    min-height: 500px;
    display: flow-root;
}

.client-notes-panel {
    margin: 12px;
}

.client-notes-table {
    width: 100%;
}

.client-notes-header-row {
    background-color: var(--bg-panel);
}

.client-notes-label-cell {
    width: 160px;
    vertical-align: top;
}

.client-notes-actions {
    margin-top: 6px;
}

.client-notes-message {
    margin-left: 10px;
}

.client-notes-history-panel {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--border-color);
    padding: 6px;
}

.settings-shell {
    width: 100%;
    height: auto;
}

.settings-editor-panel {
    margin: 0 0 0 10px;
}

.settings-list-shell {
    margin-top: 10px;
}

.settings-repeater-panel {
    background: #fff;
}

.bulk-actions-panel {
    margin: 5px 0 15px 10px;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.bulk-actions-panel h3 {
    margin-bottom: 8px;
}

.bulk-actions-panel p {
    margin: 0 0 10px;
    color: var(--text-muted);
}

.bulk-actions-input {
    resize: vertical;
    min-height: 220px;
}

.bulk-actions-buttons {
    margin-top: 10px;
    display: flex;
    gap: 6px;
}

.bulk-actions-secondary {
    margin-left: 0;
}

.bulk-actions-message-row {
    margin-top: 10px;
}

.bulk-actions-message {
    color: #b91c1c;
    font-weight: 600;
}

.reports-shell {
    margin: 5px 10px;
}

.reports-message-panel {
    margin-bottom: 8px;
    background-color: #fff7d6;
    border: 1px solid #f2de87;
    padding: 6px 10px;
    border-radius: var(--radius-md);
}

.reports-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.reports-list-panel {
    width: 260px;
}

.reports-search-row {
    margin-bottom: 8px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reports-search-label {
    display: inline-block;
}

.reports-search-input {
    margin-right: 0;
}

.reports-create-row {
    margin-bottom: 8px;
}

.reports-empty-state {
    margin-top: 12px;
    font-style: italic;
    color: var(--text-muted);
}

.reports-detail-panel {
    flex: 1;
    min-width: 0;
}

.reports-back-link-row,
.reports-title-row,
.reports-summary-row {
    margin-bottom: 6px;
}

.reports-title-meta {
    margin-left: 8px;
    color: var(--text-muted);
}

.reports-params-row,
.reports-actions-row,
.reports-form-row {
    margin-bottom: 10px;
}

.reports-help-text {
    margin-bottom: 8px;
    color: #4b5563;
}

.reports-subtitle {
    font-weight: 700;
    margin-bottom: 4px;
}

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

.reports-system-badge {
    color: var(--text-muted);
}

.reports-last-run-col {
    width: 90px;
}

.reports-last-run-cell {
    font-size: 11px;
    color: var(--text-muted);
}

.reports-subheader-row {
    background-color: var(--bg-panel);
}

.reports-parameter-col {
    width: 200px;
}

.reports-label-col,
.reports-name-col,
.reports-default-col {
    width: auto;
}

.reports-required-col {
    width: 70px;
}

.reports-remove-col {
    width: 60px;
}

.reports-center-cell {
    text-align: center;
}

.reports-period-col {
    width: 100px;
}

.reports-served-col {
    width: 250px;
}

.reports-history-title-cell {
    background-color: var(--bg-panel);
}

.reports-history-running-user,
.reports-history-action,
.reports-history-date {
    width: 250px;
}

.reports-history-type {
    width: 100px;
}

.report-results-grid {
    border-collapse: collapse;
    width: 100%;
}

.report-results-grid th,
.report-results-grid td {
    padding: 6px;
    background-color: white;
}

.report-results-grid td {
    vertical-align: top;
}

.required-indicator {
    color: #b91c1c;
    font-weight: bold;
    margin-left: 4px;
}

.user-settings,
.admin-users,
.force-reset-shell {
    padding: 5px 0 0 8px;
}

.user-settings .field,
.admin-users .field,
.force-reset-shell .field {
    display: flex;
    align-items: flex-start;
    margin-top: 2px;
    margin-bottom: 12px;
}

.user-settings .field-label,
.admin-users .field-label {
    width: 160px;
    text-align: right;
    padding-right: 12px;
    display: inline-block;
}

.admin-users .field-label {
    width: 110px;
}

.user-settings .field-control,
.admin-users .field-control {
    flex: 1;
}

.user-settings .validation,
.admin-users .validation,
.force-reset-shell .validation {
    color: #b71c1c;
    display: block;
}

.user-settings .primary,
.admin-users .primary,
.force-reset-shell .primary {
    padding: 10px 20px;
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.force-reset-shell .secondary {
    padding: 10px 20px;
    background-color: #fff;
    color: #333;
    border: 1px solid #c4c4c4;
    border-radius: 4px;
    cursor: pointer;
}

.force-reset-shell .secondary:hover {
    background-color: #f5f5f5;
}

.user-settings .hidden,
.admin-users .hidden {
    display: none;
}

.user-settings .mfa-hint {
    color: #4f566b;
}

.user-settings .mfa-status-panel {
    margin-top: 10px;
}

.admin-users .grid {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.admin-users .grid th,
.admin-users .grid td {
    border: 1px solid var(--border-color);
    padding: 8px;
}

.admin-users .grid th {
    background-color: var(--bg-panel);
    text-align: left;
}

.admin-users .action {
    margin-right: 8px;
    padding: 6px 12px;
}

.admin-users .danger {
    padding: 6px 12px;
    background-color: #b71c1c;
    color: white;
    border: none;
}

.admin-users .action-danger,
.admin-users .danger {
    background-color: #b71c1c;
    color: #ffffff;
    border: none;
}

.admin-users .action-danger:hover,
.admin-users .danger:hover {
    background-color: #991b1b;
}

/* Fully modernize DataGrid markup used for single-client directory results */
table[id*="clientGridView"] {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

table[id*="clientGridView"] > tbody > tr:first-child > td,
table[id*="clientGridView"] td.gridviewheader,
table[id*="clientGridView"] .gridviewheader {
    background-color: #e5e7eb;
    color: var(--text-main);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

table[id*="clientGridView"] > tbody > tr:not(:first-child) > td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    font-size: 0.95rem;
    color: var(--text-main);
    background: #fff;
}

table[id*="clientGridView"] > tbody > tr:not(:first-child):hover > td {
    background-color: var(--bg-panel);
}

table[id*="clientGridView"] > tbody > tr:last-child > td {
    border-bottom: none;
}

.force-reset-shell .actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.force-reset-shell .alert {
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.force-reset-shell .alert-error {
    background-color: #fdecea;
    border: 1px solid #f5c2c0;
    color: #8a1c1c;
}

.force-reset-shell .alert-success {
    background-color: #edf9f0;
    border: 1px solid #9ed9b8;
    color: #1f6f3f;
}

.force-reset-shell .mfa-container {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.force-reset-shell .mfa-container .qr {
    width: 180px;
    height: 180px;
    border: 1px solid var(--border-color);
}

.force-reset-shell .mfa-details {
    font-size: 14px;
    color: #4f566b;
}

.force-reset-shell .mfa-details p {
    margin: 4px 0;
}

.auth-page {
    font-family: var(--font-sans);
    background: radial-gradient(circle at top right, #eef2ff 0%, #f8fafc 35%, #f3f4f6 100%);
    min-height: 100vh;
    margin: 0;
}

.auth-card {
    max-width: 420px;
    margin: 80px auto;
    background: #ffffff;
    padding: 36px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-size: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.auth-page p {
    margin-bottom: 16px;
}

.auth-page label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.auth-page .remember {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.auth-page .remember input {
    margin-right: 8px;
}

.auth-page .remember label {
    margin-bottom: 0;
}

.auth-page .submit {
    width: 100%;
    padding: 12px;
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

.auth-page .submit:disabled {
    background-color: #a5b4fc;
    cursor: not-allowed;
}

.auth-page .message {
    margin-top: 16px;
    color: #d80c18;
    text-align: center;
}

.auth-page .info {
    color: #4f566b;
    font-size: 14px;
    text-align: center;
}

.auth-page .user-context {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #4f566b;
}

.auth-page .user-context .username {
    font-weight: 600;
}

.auth-page .change-user {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    font-size: 13px;
    padding: 0;
}

@media (max-width: 980px) {
    #MainContent {
        padding: 1rem;
    }

    .reports-layout {
        display: block;
    }

    .reports-list-panel {
        width: 100%;
        margin-bottom: 12px;
    }
}

@media (max-width: 640px) {
    .app-today {
        margin-top: 0;
    }

    .app-header-meta {
        width: 100%;
        align-items: flex-start;
    }

    .app-stats {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.45rem 0.55rem;
        font-size: 0.78rem;
    }

    .top-menu-signout {
        margin-left: 0;
    }

    .top-menu-stats {
        float: none;
        display: block;
    }

    .auth-card {
        margin: 24px auto;
        padding: 20px;
        width: calc(100% - 24px);
    }

    .user-settings .field,
    .admin-users .field,
    .force-reset-shell .field {
        display: block;
    }

    .user-settings .field-label,
    .admin-users .field-label {
        width: auto;
        text-align: left;
        padding-right: 0;
        margin-bottom: 6px;
    }
}
