:root {
    --primary-color: #4F32E6; 
    --primary-color-dark: #3d25c3;
    --secondary-color: #6c757d; 
    --secondary-color-dark: #5a6268;
    --sidebar-bg: #2c3e50; 
    --sidebar-text: #ecf0f1;
    --sidebar-active-bg: #34495e; 
    --sidebar-hover-bg: #3a506b;
    --content-bg: #f8fafc;
    --text-color: #2d3748; 
    --border-color: #e2e8f0;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --success-bg: #f0fff4; 
    --success-border: #9ae6b4; 
    --success-text: #22543d;
    --error-bg: #fed7d7; 
    --error-border: #feb2b2; 
    --error-text: #742a2a;
    --warning-bg: #fffbeb; 
    --warning-border: #f6e05e; 
    --warning-text: #744210;
    --expired-bg: #fed7d7; 
    --expired-border: #feb2b2; 
    --expired-text: #742a2a;
    --notice-bg: #ebf8ff; 
    --notice-border: #90cdf4; 
    --notice-text: #2a4365;
    --button-radius: 8px; 
    --input-radius: 6px;
    --chart-height: 300px;
}

* {
    box-sizing: border-box;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--content-bg); 
    margin: 0; 
    padding: 0; 
    color: var(--text-color); 
    font-size: 14px; 
    line-height: 1.6; 
    display: flex;
    min-height: 100vh;
}

.page-wrapper { 
    display: flex; 
    min-height: 100vh; 
    width: 100%; 
}

a { 
    color: var(--primary-color); 
    text-decoration: none; 
    transition: all 0.2s ease; 
}

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

h1, h2, h3, h4, h5 { 
    color: var(--text-color); 
    margin-top: 0; 
    margin-bottom: 1rem; 
    font-weight: 600; 
    line-height: 1.25;
}

h1 { font-size: 2rem; }
h2 { 
    font-size: 1.5rem; 
    border-bottom: 2px solid var(--border-color); 
    padding-bottom: 0.5rem; 
    margin-bottom: 1.5rem; 
}
h3 { 
    font-size: 1.25rem; 
    margin-bottom: 1rem; 
    margin-top: 1.5rem; 
}
h4 { 
    font-size: 1.125rem; 
    margin-bottom: 0.75rem; 
    margin-top: 1.25rem; 
}
h5 { 
    font-size: 1rem; 
    margin-bottom: 0.5rem; 
    margin-top: 1rem; 
    color: #718096; 
}

/* --- Sidebar --- */
.sidebar { 
    width: 280px; 
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #34495e 100%);
    color: var(--sidebar-text); 
    display: flex; 
    flex-direction: column; 
    position: fixed; 
    top: 0; 
    left: 0; 
    height: 100vh; 
    box-shadow: 4px 0 15px rgba(0,0,0,0.1); 
    z-index: 1000; 
    transition: all 0.3s ease; 
}

.sidebar-header { 
    padding: 1.5rem 1rem; 
    text-align: center; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); 
    background: rgba(0,0,0,0.1);
}

.sidebar-header .logo { 
    display: block; 
    height: 40px; 
    margin: 0 auto 0.75rem auto; 
    border-radius: 8px;
}

.sidebar-header h2 { 
    margin: 0; 
    font-size: 1.25rem; 
    color: var(--sidebar-text); 
    font-weight: 700; 
    border-bottom: none; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.main-nav { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 1rem 0;
}

.main-nav ul { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
}

.main-nav li { 
    margin: 0.25rem 0; 
}

.main-nav a { 
    display: flex; 
    align-items: center; 
    padding: 0.875rem 1.5rem; 
    color: var(--sidebar-text); 
    text-decoration: none; 
    font-weight: 500; 
    transition: all 0.2s ease; 
    border-left: 3px solid transparent; 
    gap: 0.75rem; 
    border-radius: 0 25px 25px 0;
    margin-right: 1rem;
}

.main-nav a span { 
    flex-grow: 1; 
}

.main-nav a:hover { 
    background: linear-gradient(90deg, var(--sidebar-hover-bg), rgba(79, 50, 230, 0.1));
    text-decoration: none; 
    border-left-color: var(--primary-color); 
    transform: translateX(4px);
}

.main-nav li.active a { 
    background: linear-gradient(90deg, var(--sidebar-active-bg), rgba(79, 50, 230, 0.2));
    color: #fff; 
    font-weight: 600; 
    border-left-color: var(--primary-color); 
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.main-nav a.logout-link { 
    color: #e74c3c; 
    margin-top: auto;
}

.main-nav a.logout-link:hover { 
    color: #c0392b; 
    background: linear-gradient(90deg, var(--sidebar-hover-bg), rgba(231, 76, 60, 0.1));
}

.sidebar-footer { 
    padding: 1rem; 
    text-align: center; 
    border-top: 1px solid rgba(255, 255, 255, 0.1); 
    margin-top: auto; 
    background: rgba(0,0,0,0.1);
}

.sidebar-footer span { 
    font-size: 0.75rem; 
    opacity: 0.8;
}

/* --- Main Content --- */
.main-content { 
    flex-grow: 1; 
    padding: 2rem 2.5rem; 
    margin-left: 280px; 
    background-color: var(--content-bg); 
    transition: margin-left 0.3s ease; 
    min-height: 100vh;
}

.main-content.no-sidebar { 
    margin-left: 0; 
    padding: 0; 
}

.content-header { 
    margin-bottom: 2rem; 
    padding-bottom: 1rem; 
    border-bottom: 2px solid var(--border-color); 
}

.content-header h1 { 
    margin: 0; 
    font-size: 1.875rem; 
    color: var(--text-color);
    font-weight: 700;
}

.content-body { 
    background: #ffffff; 
    padding: 2rem; 
    border-radius: 12px; 
    box-shadow: var(--box-shadow); 
    border: 1px solid var(--border-color);
}

.main-content.no-sidebar .content-body { 
    background: none; 
    padding: 0; 
    border-radius: 0; 
    box-shadow: none; 
    border: none;
}

/* --- Forms & Inputs --- */
.styled-form .form-group, .login-form .form-group { 
    margin-bottom: 1.5rem; 
}

.styled-form label, .login-form label { 
    display: block; 
    margin-bottom: 0.5rem; 
    font-weight: 600; 
    color: var(--text-color); 
    font-size: 0.875rem; 
}

input[type="text"], 
input[type="password"], 
input[type="email"], 
input[type="date"], 
input[type="file"], 
input[type="number"], 
select, 
textarea { 
    width: 100%; 
    padding: 0.75rem 1rem; 
    border: 2px solid var(--border-color); 
    border-radius: var(--input-radius); 
    box-sizing: border-box; 
    font-size: 0.875rem; 
    transition: all 0.2s ease; 
    background-color: #ffffff;
    font-family: inherit;
}

textarea { 
    min-height: 100px; 
    resize: vertical; 
}

input:focus, select:focus, textarea:focus { 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 3px rgba(79, 50, 230, 0.1); 
    outline: none; 
}

input[readonly] { 
    background-color: #f7fafc; 
    cursor: not-allowed; 
    color: #718096;
}

input[disabled] { 
    background-color: #edf2f7; 
    cursor: not-allowed; 
    opacity: 0.6; 
}

.form-group small { 
    display: block; 
    margin-top: 0.375rem; 
    font-size: 0.75rem; 
    color: #718096; 
}

.form-static-text { 
    font-size: 0.875rem; 
    color: #718096; 
    padding-top: 0.75rem; 
    font-style: italic;
}

.form-condensed .form-group { 
    margin-bottom: 1rem; 
}

.input-sm { 
    padding: 0.5rem 0.75rem; 
    font-size: 0.8125rem; 
    height: auto; 
}

/* --- Buttons --- */
.btn, button { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.5rem; 
    padding: 0.75rem 1.5rem; 
    font-size: 0.875rem; 
    font-weight: 600; 
    text-align: center; 
    border: none; 
    border-radius: var(--button-radius); 
    cursor: pointer; 
    transition: all 0.2s ease; 
    text-decoration: none; 
    line-height: 1.25; 
    margin-right: 0.5rem; 
    vertical-align: middle; 
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

button:last-child, .btn:last-child { 
    margin-right: 0; 
}

button:disabled { 
    opacity: 0.5; 
    cursor: not-allowed !important; 
    transform: none !important;
}

.btn-primary, button[type="submit"] { 
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    color: white; 
}

.btn-primary:hover, button[type="submit"]:hover:not(:disabled) { 
    background: linear-gradient(135deg, var(--primary-color-dark), #2d1b69);
    box-shadow: 0 4px 12px rgba(79, 50, 230, 0.3);
    transform: translateY(-1px);
}

.btn-secondary { 
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-color-dark));
    color: white; 
}

.btn-secondary:hover:not(:disabled) { 
    background: linear-gradient(135deg, var(--secondary-color-dark), #495057);
    transform: translateY(-1px);
}

.btn-warning { 
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white; 
}

.btn-warning:hover:not(:disabled) { 
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
}

.btn-warning.active { 
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); 
}

.btn-search { 
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white; 
    padding: 0.75rem 1.25rem; 
}

.btn-search:hover:not(:disabled) { 
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
}

.actions .btn, .actions button, .btn-sm { 
    padding: 0.375rem 0.75rem; 
    font-size: 0.8125rem; 
    margin: 0 0.25rem; 
    line-height: 1.2; 
    border-radius: 6px; 
    vertical-align: middle; 
}

.btn-edit { 
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white; 
}

.btn-edit:hover:not(:disabled) { 
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
}

.btn-toggle { 
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white; 
}

.btn-toggle:hover:not(:disabled) { 
    background: linear-gradient(135deg, #0891b2, #0e7490);
    transform: translateY(-1px);
}

.btn-delete { 
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white; 
}

.btn-delete:hover:not(:disabled) { 
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
}

.btn-test { 
    background: linear-gradient(135deg, #10b981, #059669);
    color: white; 
}

.btn-test:hover:not(:disabled) { 
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.btn-copy { 
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-color-dark));
    color: white; 
}

.btn-copy:hover:not(:disabled) { 
    background: linear-gradient(135deg, var(--secondary-color-dark), #495057);
    transform: translateY(-1px);
}

.link-inline { 
    display: inline; 
    padding: 0; 
    margin: 0; 
    background: none; 
    border: none; 
    color: var(--primary-color); 
    text-decoration: underline; 
    box-shadow: none;
}

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

/* --- Messages & Notifications --- */
#messages-container { 
    margin-bottom: 1.5rem; 
}

.message { 
    padding: 1rem 1.25rem; 
    border-radius: var(--button-radius); 
    margin-bottom: 1rem; 
    border: 1px solid transparent; 
    font-size: 0.875rem; 
    position: relative; 
    opacity: 1; 
    transition: all 0.3s ease; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message.hidden { 
    opacity: 0; 
    height: 0; 
    padding-top: 0; 
    padding-bottom: 0; 
    margin-bottom: 0; 
    border: none; 
    overflow: hidden; 
}

.success-message { 
    background-color: var(--success-bg); 
    border-color: var(--success-border); 
    color: var(--success-text); 
}

.error-message { 
    background-color: var(--error-bg); 
    border-color: var(--error-border); 
    color: var(--error-text); 
}

.notice { 
    background-color: var(--notice-bg); 
    border-color: var(--notice-border); 
    color: var(--notice-text); 
}

.close-message { 
    position: absolute; 
    top: 50%; 
    right: 1rem; 
    transform: translateY(-50%); 
    font-size: 1.25rem; 
    font-weight: bold; 
    color: inherit; 
    opacity: 0.7; 
    cursor: pointer; 
    background: none; 
    border: none; 
    padding: 0; 
    line-height: 1; 
    transition: opacity 0.2s ease;
}

.close-message:hover { 
    opacity: 1; 
}

/* --- Login Page --- */
.login-container { 
    max-width: 450px; 
    margin: 3rem auto; 
    padding: 2.5rem; 
    background: #ffffff; 
    border-radius: 16px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); 
    border: 1px solid var(--border-color);
}

.login-header { 
    text-align: center; 
    margin-bottom: 2rem; 
    border-bottom: none; 
}

.login-header .logo { 
    height: 60px; 
    margin-bottom: 1rem; 
    border-radius: 8px;
}

.login-header h1 { 
    font-size: 1.75rem; 
    color: var(--text-color); 
    font-weight: 700;
}

.login-form button { 
    width: 100%; 
    padding: 0.875rem; 
    font-size: 1rem; 
    margin-top: 0.75rem; 
}

/* --- Tables --- */
.table-responsive { 
    overflow-x: auto; 
    margin-top: 1rem; 
    width: 100%; 
    border: 1px solid var(--border-color); 
    border-radius: var(--input-radius); 
    box-shadow: var(--box-shadow); 
    background: #ffffff;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-bottom: 0; 
    background-color: #ffffff; 
    table-layout: auto; 
}

table th, table td { 
    border: none; 
    border-bottom: 1px solid var(--border-color); 
    padding: 0.875rem 1rem; 
    font-size: 0.875rem; 
    text-align: left; 
    vertical-align: middle; 
    line-height: 1.4; 
}

table thead th { 
    border-bottom-width: 2px; 
    border-color: #cbd5e0; 
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    color: var(--text-color); 
    font-weight: 700; 
    white-space: nowrap; 
    cursor: default; 
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

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

table th.sortable { 
    cursor: pointer; 
    position: relative; 
    padding-right: 2rem; 
    transition: background-color 0.2s ease;
}

table th.sortable:hover {
    background: linear-gradient(135deg, #edf2f7, #e2e8f0);
}

table th.sortable::after { 
    content: ' ↕'; 
    position: absolute; 
    right: 0.5rem; 
    top: 50%; 
    transform: translateY(-50%); 
    opacity: 0.4; 
    font-size: 0.75rem; 
}

table th.sortable.asc::after { 
    content: ' ↑'; 
    opacity: 1; 
    color: var(--primary-color);
}

table th.sortable.desc::after { 
    content: ' ↓'; 
    opacity: 1; 
    color: var(--primary-color);
}

table tbody tr { 
    transition: background-color 0.2s ease; 
}

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

td.actions { 
    text-align: left; 
    white-space: nowrap; 
    min-width: 150px; 
}

td.test-action { 
    text-align: center; 
    min-width: 180px; 
    white-space: nowrap; 
    position: relative; 
}

td.code { 
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace; 
    font-size: 0.8125rem; 
    word-break: break-all; 
    line-height: 1.3; 
    min-width: 150px; 
    background-color: #f7fafc;
    border-radius: 4px;
    padding: 0.5rem;
}

td:nth-child(1), td:nth-child(2) { 
    word-break: break-word; 
}

.status-active, .status-inactive { 
    padding: 0.25rem 0.75rem; 
    border-radius: 20px; 
    font-size: 0.6875rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    display: inline-block; 
    line-height: 1.2; 
    text-align: center; 
    min-width: 70px; 
    letter-spacing: 0.025em;
}

.status-active { 
    background: linear-gradient(135deg, var(--success-bg), #c6f6d5);
    color: var(--success-text); 
    border: 1px solid var(--success-border); 
}

.status-inactive { 
    background: linear-gradient(135deg, var(--notice-bg), #e2e8f0);
    color: var(--notice-text); 
    border: 1px solid var(--notice-border); 
}

/* --- Search & Pagination --- */
.search-container { 
    display: flex; 
    align-items: center; 
    gap: 0.75rem; 
    margin-bottom: 1.5rem; 
    flex-wrap: wrap; 
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
}

.search-input { 
    flex-grow: 1; 
    padding: 0.75rem 1rem; 
    font-size: 0.875rem; 
    border: 2px solid var(--border-color); 
    border-radius: var(--input-radius); 
    outline: none; 
    transition: all 0.2s ease; 
    min-width: 250px; 
    background-color: #ffffff;
}

.search-input:focus { 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 3px rgba(79, 50, 230, 0.1);
}

.search-container .btn { 
    flex-shrink: 0; 
}

.pagination { 
    display: flex; 
    justify-content: center; 
    padding-left: 0; 
    list-style: none; 
    border-radius: 8px; 
    margin-top: 2rem; 
    flex-wrap: wrap; 
}

.page-item.disabled .page-link { 
    color: #a0aec0; 
    pointer-events: none; 
    cursor: auto; 
    background-color: #ffffff; 
    border-color: var(--border-color); 
}

.page-item.active .page-link { 
    z-index: 1; 
    color: #ffffff; 
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark));
    border-color: var(--primary-color); 
    box-shadow: 0 2px 4px rgba(79, 50, 230, 0.2);
}

.page-link { 
    position: relative; 
    display: block; 
    padding: 0.5rem 0.75rem; 
    margin-left: -1px; 
    line-height: 1.25; 
    color: var(--primary-color); 
    background-color: #ffffff; 
    border: 1px solid var(--border-color); 
    text-decoration: none; 
    transition: all 0.2s ease; 
}

.page-link:hover { 
    z-index: 2; 
    color: var(--primary-color-dark); 
    background-color: #f7fafc; 
    border-color: var(--border-color); 
    text-decoration: none; 
}

.page-item:first-child .page-link { 
    margin-left: 0; 
    border-top-left-radius: 8px; 
    border-bottom-left-radius: 8px; 
}

.page-item:last-child .page-link { 
    border-top-right-radius: 8px; 
    border-bottom-right-radius: 8px; 
}

/* --- Dashboard Specific --- */
.dashboard-section { 
    margin-bottom: 2rem; 
}

.dashboard-search { 
    margin-bottom: 1.5rem; 
}

.dashboard-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 1.5rem; 
    margin-top: 1.5rem; 
}

.dashboard-card { 
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    padding: 1.75rem; 
    border-radius: 16px; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column; 
    transition: all 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.dashboard-card h3 { 
    margin-top: 0; 
    margin-bottom: 1rem; 
    font-size: 1rem; 
    color: #718096; 
    border-bottom: 2px solid var(--border-color); 
    padding-bottom: 0.5rem; 
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.dashboard-card .count { 
    font-size: 2.5rem; 
    font-weight: 700; 
    color: var(--primary-color); 
    display: block; 
    margin-bottom: 0.5rem; 
    line-height: 1;
}

.dashboard-card .description { 
    font-size: 0.875rem; 
    color: #718096; 
    margin-bottom: auto; 
    line-height: 1.4;
}

.dashboard-card .card-link { 
    font-size: 0.8125rem; 
    margin-top: 0.75rem; 
    display: block; 
    text-align: right; 
    font-weight: 600; 
    color: var(--primary-color);
}

.quick-actions .btn { 
    display: block; 
    margin-bottom: 0.75rem; 
    text-align: center; 
    width: 100%;
}

.quick-actions .btn:last-child { 
    margin-bottom: 0; 
}

.chart-grid { 
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); 
}

.chart-card { 
    min-height: calc(var(--chart-height) + 100px); 
}

.chart-container { 
    position: relative; 
    height: var(--chart-height); 
    width: 100%; 
    margin-top: 1rem;
}

.list-grid { 
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); 
}

.list-card { 
    min-height: 350px; 
}

.table-responsive-mini { 
    max-height: 250px; 
    overflow-y: auto; 
    margin-bottom: 0.75rem; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
}

.table-responsive-mini table { 
    width: 100%; 
    font-size: 0.8125rem; 
}

.table-responsive-mini th, .table-responsive-mini td { 
    padding: 0.5rem 0.75rem; 
}

.activity-list { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    max-height: 300px; 
    overflow-y: auto; 
}

.activity-list li { 
    border-bottom: 1px dashed var(--border-color); 
    padding: 0.75rem 0; 
    font-size: 0.8125rem; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.375rem 0.75rem; 
}

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

.activity-list .timestamp { 
    color: #718096; 
    font-size: 0.75rem; 
    flex-basis: 120px; 
    flex-shrink: 0; 
    font-weight: 500;
}

.activity-list .user { 
    font-weight: 600; 
    color: var(--primary-color); 
    flex-shrink: 0; 
}

.activity-list .action { 
    color: var(--text-color); 
    flex-grow: 1; 
    font-weight: 500;
}

.activity-list .details { 
    color: #a0aec0; 
    font-style: italic; 
    font-size: 0.75rem; 
    word-break: break-all; 
    flex-basis: 100%; 
}

/* --- Test Result Display --- */
.test-result-display { 
    margin-top: 0.75rem; 
    padding: 1rem; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    background-color: #f8fafc; 
    font-size: 0.8125rem; 
    line-height: 1.5; 
    max-height: 300px; 
    overflow-y: auto; 
    display: none; 
    text-align: left; 
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); 
}

.test-result-display.visible { 
    display: block; 
}

.test-result-display.loading span { 
    color: #718096; 
    font-style: italic; 
}

.test-result-display.error { 
    color: var(--error-text); 
    background-color: var(--error-bg); 
    border-color: var(--error-border); 
}

.test-result-display hr { 
    border: none; 
    border-top: 1px dashed var(--border-color); 
    margin: 0.75rem 0; 
}

.test-result-display .result-status { 
    padding: 0.5rem 0.75rem; 
    margin: -1rem -1rem 0.75rem -1rem; 
    border-bottom: 1px solid var(--border-color); 
    font-weight: bold; 
    text-align: center; 
    border-radius: 8px 8px 0 0;
}

.test-result-display .result-status-valid { 
    background: linear-gradient(135deg, var(--success-bg), #c6f6d5);
    color: var(--success-text); 
    border-color: var(--success-border); 
}

.test-result-display .result-status-invalid, 
.test-result-display .result-status-inactive { 
    background: linear-gradient(135deg, var(--warning-bg), #fef3c7);
    color: var(--warning-text); 
    border-color: var(--warning-border); 
}

.test-result-display .result-status-expired { 
    background: linear-gradient(135deg, var(--expired-bg), #fecaca);
    color: var(--expired-text); 
    border-color: var(--expired-border); 
}

.test-result-display .result-status-error { 
    background: linear-gradient(135deg, var(--error-bg), #fecaca);
    color: var(--error-text); 
    border-color: var(--error-border); 
}

.test-result-display .result-message { 
    font-style: italic; 
    color: #718096; 
    margin-bottom: 0.75rem; 
}

.test-result-display .result-details div { 
    margin-bottom: 0.375rem; 
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace; 
    word-break: break-all; 
}

.test-result-display .result-details strong { 
    display: inline-block; 
    min-width: 120px; 
    color: var(--primary-color); 
    font-weight: 600;
}

/* --- Settings Page Specific --- */
.settings-section { 
    margin-bottom: 3rem; 
    padding-bottom: 1.5rem; 
}

.settings-section:not(:last-child) { 
    border-bottom: 2px solid var(--border-color); 
}

.settings-section h2 { 
    border-bottom: none; 
    margin-bottom: 1.5rem; 
    color: var(--primary-color);
    font-weight: 700;
}

.settings-section h3 { 
    border-bottom: 1px dashed var(--border-color); 
    padding-bottom: 0.5rem; 
    margin-top: 1.5rem; 
    margin-bottom: 1.5rem; 
    font-size: 1.125rem; 
    color: var(--primary-color); 
    font-weight: 600;
}

.settings-section p { 
    margin-bottom: 1rem; 
    line-height: 1.6; 
    color: #4a5568;
}

hr.settings-divider { 
    margin: 3rem 0; 
    border: 0; 
    border-top: 3px solid var(--primary-color); 
    opacity: 0.3; 
}

hr.compact-divider { 
    margin: 1.5rem 0; 
    border: 0; 
    border-top: 1px solid var(--border-color); 
}

/* Import Results */
.import-results ul { 
    list-style-type: none; 
    padding-left: 0; 
    margin-top: 0.75rem; 
}

.import-results li { 
    margin-bottom: 0.375rem; 
    font-size: 0.8125rem; 
    padding: 0.25rem 0.5rem; 
    border-radius: 4px; 
}

.import-results .skipped { 
    color: var(--warning-text); 
    background-color: var(--warning-bg); 
}

.import-results .error { 
    color: var(--error-text); 
    background-color: var(--error-bg); 
}

.import-results .imported { 
    color: var(--success-text); 
    background-color: var(--success-bg); 
}

.import-details-list { 
    max-height: 350px; 
    overflow-y: auto; 
    border: 1px solid var(--border-color); 
    padding: 0.75rem; 
    background: #f8fafc; 
    border-radius: 8px; 
    font-size: 0.875rem; 
}

/* Admin Table */
.admin-table td.actions { 
    white-space: normal; 
}

.admin-table .inline-form { 
    display: inline-block; 
    margin-right: 0.375rem; 
    vertical-align: middle; 
}

.admin-table .inline-form input[type="password"] { 
    width: 150px; 
    margin-right: 0.25rem; 
}

/* Rate Limit Log Display */
.log-display { 
    background-color: #f8fafc; 
    border: 1px solid var(--border-color); 
    padding: 1rem; 
    border-radius: var(--input-radius); 
    max-height: 350px; 
    overflow-y: auto; 
    font-size: 0.8125rem; 
    white-space: pre-wrap; 
    word-wrap: break-word; 
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

/* System Info List */
.system-info-list { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
}

.system-info-list li { 
    margin-bottom: 0.75rem; 
    font-size: 0.875rem; 
    border-bottom: 1px dotted var(--border-color); 
    padding-bottom: 0.75rem; 
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.system-info-list li:last-child { 
    border-bottom: none; 
    margin-bottom: 0; 
    padding-bottom: 0; 
}

.system-info-list span { 
    font-weight: 600; 
    color: var(--text-color); 
}

.system-info-list .perm-ok { 
    color: var(--success-text); 
    font-weight: bold; 
}

.system-info-list .perm-error { 
    color: var(--error-text); 
    font-weight: bold; 
}

.system-info-list .perm-warn { 
    color: var(--warning-text); 
    font-weight: bold; 
}

/* --- Responsive Adjustments --- */
@media (max-width: 1200px) {
    .sidebar { 
        width: 250px; 
    }
    .main-content { 
        margin-left: 250px; 
        padding: 1.5rem 2rem; 
    }
    .dashboard-grid { 
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    }
    .chart-grid, .list-grid { 
        grid-template-columns: 1fr; 
    }
    .admin-table .inline-form input[type="password"] { 
        width: 120px; 
    }
}

@media (max-width: 768px) {
    .sidebar { 
        width: 70px; 
        overflow: hidden; 
    }
    .sidebar:hover { 
        width: 250px; 
    }
    .sidebar-header .logo { 
        margin: 0 auto 0.5rem auto; 
        height: 32px; 
    }
    .sidebar-header h2 { 
        display: none; 
        font-size: 1rem; 
    }
    .sidebar:hover .sidebar-header h2 { 
        display: block; 
    }
    .main-nav a { 
        text-align: center; 
        padding: 1rem 0.75rem; 
        border-radius: 0;
        margin-right: 0;
    }
    .main-nav a span { 
        display: none; 
    }
    .sidebar:hover .main-nav a span { 
        display: inline; 
    }
    .sidebar:hover .main-nav a { 
        text-align: left; 
        padding: 0.875rem 1.5rem; 
        border-radius: 0 25px 25px 0;
        margin-right: 1rem;
    }
    .main-content { 
        margin-left: 70px; 
        padding: 1rem 1.5rem; 
    }
    .sidebar:hover ~ .main-content { 
        margin-left: 250px; 
    }
    .content-body { 
        padding: 1.5rem; 
    }
    .search-container { 
        flex-direction: column; 
        align-items: stretch; 
        padding: 1rem;
    }
    .search-container .btn { 
        width: 100%; 
        margin-top: 0.75rem; 
    }
    .search-input {
        min-width: auto;
    }
    table th, table td { 
        padding: 0.5rem 0.75rem; 
        font-size: 0.8125rem; 
    }
    td.actions { 
        min-width: auto; 
        white-space: normal; 
    }
    td.code { 
        min-width: 120px; 
        font-size: 0.75rem; 
    }
    td.test-action { 
        min-width: auto; 
        white-space: normal; 
    }
    table th.sortable { 
        padding-right: 1.5rem; 
    }
    table th.sortable::after { 
        font-size: 0.625rem; 
        right: 0.375rem; 
    }
    .dashboard-grid { 
        gap: 1rem; 
    }
    .dashboard-card { 
        padding: 1.5rem; 
    }
    .dashboard-card .count { 
        font-size: 2rem; 
    }
    .admin-table .inline-form { 
        display: block; 
        margin-bottom: 0.375rem; 
    }
    .admin-table .inline-form input[type="password"] { 
        width: calc(50% - 0.25rem); 
    }
    .admin-table .inline-form button { 
        width: 100%; 
        margin-top: 0.375rem; 
    }
}

@media (max-width: 480px) {
    .sidebar { 
        width: 70px; 
    }
    .sidebar:hover { 
        width: 70px; 
    }
    .sidebar-header .logo { 
        margin: 0 auto; 
        height: 28px; 
    }
    .sidebar-header h2 { 
        display: none; 
    }
    .main-nav a span { 
        display: none; 
    }
    .main-nav a { 
        text-align: center; 
        padding: 1rem 0.5rem; 
        border-radius: 0;
        margin-right: 0;
    }
    .main-content { 
        margin-left: 70px; 
        padding: 0.75rem 1rem; 
    }
    .sidebar:hover ~ .main-content { 
        margin-left: 70px; 
    }
    .content-body { 
        padding: 1rem; 
    }
    h1 { 
        font-size: 1.5rem; 
    }
    h2 { 
        font-size: 1.25rem; 
        margin-bottom: 1rem; 
    }
    h3 { 
        font-size: 1.125rem; 
    }
    table th, table td { 
        padding: 0.375rem 0.5rem; 
        font-size: 0.75rem; 
    }
    .actions .btn, .actions button, .btn-sm { 
        padding: 0.25rem 0.5rem; 
        font-size: 0.75rem; 
        margin: 0.125rem; 
    }
    td.code { 
        font-size: 0.6875rem; 
    }
    .status-active, .status-inactive { 
        padding: 0.1875rem 0.5rem; 
        font-size: 0.625rem; 
        min-width: auto; 
    }
    .dashboard-grid { 
        grid-template-columns: 1fr; 
    }
    .dashboard-card { 
        padding: 1.25rem; 
    }
    .dashboard-card .count { 
        font-size: 1.75rem; 
    }
    .chart-container { 
        height: 250px; 
    }
    .chart-card { 
        min-height: calc(250px + 80px); 
    }
    .activity-list li { 
        font-size: 0.75rem; 
    }
    .activity-list .timestamp { 
        flex-basis: 100px; 
    }
    .admin-table .inline-form input[type="password"] { 
        width: 100%; 
        margin-bottom: 0.375rem; 
    }
    .login-container {
        margin: 1rem auto;
        padding: 1.5rem;
    }
    .search-container {
        padding: 0.75rem;
    }
}

/* --- Loading States --- */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.dashboard-card,
.content-body,
.message {
    animation: fadeIn 0.3s ease-out;
}

/* --- Focus States --- */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
.btn:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 50, 230, 0.1);
}

/* --- Print Styles --- */
@media print {
    .sidebar,
    .search-container,
    .pagination,
    .actions,
    .test-action {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .content-body {
        box-shadow: none !important;
        border: none !important;
    }
    
    table {
        font-size: 12px !important;
    }
}
