/**
 * TIX Consumption - Main Stylesheet
 * Consolidated styles for all application pages
 */

/* ==========================================================================
   1. CSS Variables / Custom Properties
   ========================================================================== */
:root {
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    /*--primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    --primary-gradient: linear-gradient(90deg, #003eab 0%, #5183ff 100%);
    /*--alt-gradient: linear-gradient(-105deg, #003eab, #5183ff);*/

    --text-dark: #333;
    --text-medium: #555;
    --text-light: #666;

    --bg-light: #f5f6fa;
    --bg-white: #fff;

    --border-color: #ddd;
    --border-light: #eee;

    --success-bg: #d4edda;
    --success-text: #155724;
    --success-border: #c3e6cb;

    --danger-bg: #f8d7da;
    --danger-text: #721c24;
    --danger-border: #f5c6cb;

    --warning-bg: #fff3cd;
    --warning-text: #856404;
    --warning-border: #ffeeba;

    --info-bg: #e8f4f8;
    --info-text: #0c5460;
    --info-border: #bee5eb;

    --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-medium: 0 15px 35px rgba(0,0,0,0.5);
    --shadow-button: 0 5px 15px rgba(102, 126, 234, 0.4);

    --border-radius: 5px;
    --border-radius-lg: 10px;
    --border-radius-pill: 20px;

    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-family-rtl: 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* ==========================================================================
   2. Base / Reset
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    background: var(--primary-gradient);
    font-family: var(--font-family);
    min-height: 100vh;
    line-height: 1.5;
}

body.auth-page {
   /* background-image:  url("../images/wave_blue_blue_bg.jpg");*/
    background-image: url("../images/Waves6.svg");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Dashboard/Admin pages body */
body.dashboard-page {
    /*background: var(--bg-light);*/
   /* background-image:  url("../images/wave_blue_blue_bg.jpg");*/
    background-image: url("../images/Waves6.svg");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;

}

/* ==========================================================================
   3. Typography
   ========================================================================== */
h1 {
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 30px;
}

h1.title-compact {
    margin-bottom: 15px;
}

h2 {
    color: var(--text-dark);
    margin-bottom: 10px;
}

h3 {
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
}

/* ==========================================================================
   4. Layout Containers
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Auth containers */
.auth-container {
    background: var(--bg-white) ;
   /* background: rgba(255, 255, 255, 0.9);*/
    /*background: rgba(221, 221, 255, 0.65);*/
    padding: 40px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium);
    width: 100%;
    max-width: 400px;
}

.auth-container-wide {
    max-width: 450px;
}

/* Cards */
.card {
    background: var(--bg-white);
    padding: 25px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
}

.welcome-card {
    background: var(--bg-white);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    margin-bottom: 20px;
}

.welcome-card h2 {
    color: var(--text-dark);
    margin-bottom: 10px;
}

.welcome-card p {
    color: var(--text-light);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: var(--bg-white);
    padding: 25px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
}

.stat-card h3 {
    color: var(--primary-color);
    font-size: 14px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: bold;
    color: var(--text-dark);
}

/* Page Header */
.page-header {
    background: var(--bg-white);
    padding: 20px 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h2 {
    color: var(--text-dark);
    margin-bottom: 0;
}

/* ==========================================================================
   5. Navigation
   ========================================================================== */
.navbar {
    background: var(--primary-gradient);
    padding: 15px 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-light);
}

.navbar h1 {
    font-size: 24px;
    color: white;
    margin-bottom: 0;
    text-align: left;
}

.navbar-logo {
    height: 30px;
    width: auto;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-right span {
    font-size: 14px;
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   6. Forms
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-medium);
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.password-requirements {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

/* ==========================================================================
   7. Password Toggle
   ========================================================================== */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 45px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    width: auto;
}

.password-toggle:hover {
    color: var(--primary-color);
    transform: translateY(-50%);
    box-shadow: none;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   8. Buttons
   ========================================================================== */
button {
    width: 100%;
    padding: 12px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-button);
}

button[type="submit"] {
    margin-top: 10px;
}

/* ==========================================================================
   9. Alerts
   ========================================================================== */
.alert {
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
}

.alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.alert-warning {
    background-color: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}

.alert-info {
    background-color: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* ==========================================================================
   10. Links
   ========================================================================== */
.links {
    text-align: center;
    margin-top: 20px;
}

.links a {
    color: var(--primary-color);
    text-decoration: none;
}

.links a:hover {
    text-decoration: underline;
}

.links p {
    margin-bottom: 10px;
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   11. Language Selector
   ========================================================================== */
.lang-selector-top {
    position: absolute;
    top: 20px;
    right: 20px;
}

.lang-selector {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
}

.lang-selector option {
    color: var(--text-dark);
}

/* Navbar language selector (no border) */
.navbar .lang-selector {
    border: none;
}

/* ==========================================================================
   12. Badges
   ========================================================================== */
.roles-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: var(--border-radius-pill);
    font-size: 12px;
    margin-right: 5px;
    margin-top: 5px;
}

/* Table roles badge (smaller) */
.users-table .roles-badge {
    padding: 2px 8px;
    font-size: 10px;
    margin-top: 0;
}

/* ==========================================================================
   13. Tables
   ========================================================================== */
.users-table {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-dark);
    text-transform: uppercase;
    font-size: 11px;
}

tr:hover {
    background: #f8f9fa;
}

tr.user-disabled {
    background: #f5f5f5;
    opacity: 0.6;
}

tr.user-disabled:hover {
    background: #ebebeb;
}

.status-enabled {
    color: #28a745;
    font-weight: 500;
}

.status-disabled {
    color: #dc3545;
    font-weight: 500;
}

.status-cell {
    text-align: center;
    width: 50px;
}

.status-cell input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: default;
}

.nowrap {
    white-space: nowrap;
}

/* Summary/Total rows in tables */
.summary-footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 2px solid var(--primary-color);
}

.summary-row td {
    font-weight: 600;
    color: var(--text-dark);
    padding: 12px;
}

.summary-row:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.sum-value {
    color: var(--primary-color);
    font-size: 1.1em;
}

/* ==========================================================================
   14. Admin Section
   ========================================================================== */
.admin-section {
    background: var(--warning-bg);
    border: 1px solid #ffc107;
    padding: 20px;
    border-radius: var(--border-radius-lg);
    margin-top: 20px;
}

.admin-section h3 {
    color: var(--warning-text);
    margin-bottom: 10px;
}

.admin-section a {
    color: var(--warning-text);
}

/* ==========================================================================
   15. Error Pages
   ========================================================================== */
.error-container {
    background: var(--bg-white);
    padding: 60px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium);
    text-align: center;
    max-width: 500px;
}

.error-code {
    font-size: 100px;
    font-weight: bold;
    color: #dc3545;
    margin-bottom: 20px;
}

.error-container h1 {
    color: var(--text-dark);
    margin-bottom: 15px;
}

.error-container p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.error-container a {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary-gradient);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: transform 0.2s;
}

.error-container a:hover {
    transform: translateY(-2px);
}

/* ==========================================================================
   16. User Info Box
   ========================================================================== */
.user-info {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
    color: var(--info-text);
}

/* ==========================================================================
   17. Reset Link Box
   ========================================================================== */
.reset-link {
    background-color: var(--info-bg);
    border: 1px solid var(--info-border);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    word-break: break-all;
}

.reset-link p {
    margin-bottom: 10px;
    color: var(--info-text);
}

.reset-link a {
    color: var(--primary-color);
    font-weight: bold;
}

/* ==========================================================================
   18. RTL Support
   ========================================================================== */
[dir="rtl"] {
    font-family: var(--font-family-rtl);
}

[dir="rtl"] .lang-selector-top {
    right: auto;
    left: 20px;
}

[dir="rtl"] .password-wrapper input {
    padding-right: 15px;
    padding-left: 45px;
}

[dir="rtl"] .password-toggle {
    right: auto;
    left: 12px;
}

[dir="rtl"] .links {
    text-align: center;
}

[dir="rtl"] .navbar {
    flex-direction: row-reverse;
}

[dir="rtl"] .navbar h1 {
    text-align: right;
}

[dir="rtl"] .navbar-right {
    flex-direction: row-reverse;
}

[dir="rtl"] .welcome-card {
    text-align: right;
}

[dir="rtl"] .stat-card {
    text-align: right;
}

[dir="rtl"] .admin-section {
    text-align: right;
}

[dir="rtl"] .roles-badge {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .page-header {
    flex-direction: row-reverse;
}

[dir="rtl"] th,
[dir="rtl"] td {
    text-align: right;
}

/* ==========================================================================
   19. Utility Classes
   ========================================================================== */
.text-center {
    text-align: center;
}

.mt-15 {
    margin-top: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.inline-form {
    display: inline;
}

/* ==========================================================================
   20. Page Header Actions
   ========================================================================== */
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ==========================================================================
   21. Button Variants
   ========================================================================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.5;
    min-height: 42px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    width: auto;
   /* box-sizing: border-box;*/
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-button);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.5;
    max-height: 42px;
    min-height: 42px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
    width: auto;
  /*  box-sizing: border-box;*/
}

.btn-secondary:hover {
    background: #5a6268;
    transform: none;
    box-shadow: none;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    min-height: auto;
    max-height: none;
    line-height: 1.5;
}

/* ==========================================================================
   22. Modal
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 15px;
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: auto;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-dark);
    transform: none;
    box-shadow: none;
}

.modal-body {
    padding: 20px 25px;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Compact form styles for modals */
.modal-body .form-group {
    margin-bottom: 12px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body label {
    margin-bottom: 4px;
    font-size: 13px;
}

.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body input[type="tel"],
.modal-body .form-control {
    padding: 8px 12px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

.modal-body select.form-control {
    padding: 8px 12px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 3px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 25px;
    border-top: 1px solid var(--border-light);
    background: #f8f9fa;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.modal-footer button {
    padding: 8px 16px;
    font-size: 13px;
    line-height: 1.5;
    height: auto;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   23. Form Controls
   ========================================================================== */
.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

select.form-control {
    cursor: pointer;
    background: var(--bg-white);
}

/* ==========================================================================
   24. Checkbox Styles
   ========================================================================== */
.roles-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
    transition: background 0.2s, border-color 0.2s;
}

.checkbox-label:hover {
    background: #e9ecef;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"]:checked + span,
.checkbox-label:has(input:checked) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==========================================================================
   25. Modal Responsive
   ========================================================================== */
@media (max-width: 540px) {
    .modal-content {
        max-width: calc(100% - 20px);
        margin: 10px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 15px;
        padding-right: 15px;
    }

    .modal-footer {
        justify-content: center;
    }

    .modal-footer button {
        flex: 1;
        min-width: 100px;
    }
}

/* ==========================================================================
   26. RTL Modal Support
   ========================================================================== */
[dir="rtl"] .modal-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .modal-footer {
    flex-direction: row-reverse;
}

[dir="rtl"] .page-header-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .checkbox-label {
    flex-direction: row-reverse;
}

/* ==========================================================================
   26. Action Buttons
   ========================================================================== */
.actions-cell {
    white-space: nowrap;
}

.btn-edit,
.btn-clone,
.btn-delete {
    display: inline-block;
    padding: 6px 12px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    margin-right: 5px;
    width: auto;
}

.btn-edit {
    background: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: none;
}

.btn-clone {
    background: #28a745;
    color: white;
}

.btn-clone:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: none;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: none;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.5;
    min-height: 42px;
    cursor: pointer;
    transition: background 0.2s;
    width: auto;
    box-sizing: border-box;
}

.btn-danger:hover {
    background: #c82333;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   27. Modal Variants
   ========================================================================== */
.modal-small {
    max-width: 400px;
}

.delete-username {
    font-weight: bold;
    color: var(--text-dark);
    margin-top: 10px;
}

/* ==========================================================================
   28. RTL Action Buttons
   ========================================================================== */
[dir="rtl"] .btn-edit,
[dir="rtl"] .btn-clone,
[dir="rtl"] .btn-delete {
    margin-right: 0;
    margin-left: 5px;
}

[dir="rtl"] .actions-cell {
    text-align: left;
}

/* ==========================================================================
   29. Profile Page
   ========================================================================== */
.profile-card {
    background: var(--bg-white);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    margin-bottom: 20px;
}

.profile-card h2 {
    color: var(--text-dark);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.profile-item {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}

.profile-item:last-child {
    border-bottom: none;
}

.profile-label {
    font-weight: 600;
    color: var(--text-medium);
    width: 150px;
    min-width: 150px;
}

.profile-value {
    color: var(--text-dark);
    flex: 1;
}

.profile-actions {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

/* ==========================================================================
   30. Action Section
   ========================================================================== */
.action-section {
    background: var(--bg-white);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    margin-top: 20px;
}

.action-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.action-section a {
    color: var(--primary-color);
    text-decoration: none;
}

.action-section a:hover {
    text-decoration: underline;
}

.action-section p {
    margin-bottom: 10px;
}

/* ==========================================================================
   31. Demo Notice
   ========================================================================== */
.demo-notice {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    margin-top: 20px;
}

.demo-notice h3 {
    color: var(--info-text);
    margin-bottom: 10px;
}

.demo-notice p {
    color: var(--info-text);
    margin: 0;
}

/* ==========================================================================
   32. Form Helpers
   ========================================================================== */
.form-text {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

.form-actions {
    margin-top: 25px;
    display: flex;
    gap: 15px;
    align-items: center;
}

/* ==========================================================================
   33. RTL Profile Support
   ========================================================================== */
[dir="rtl"] .profile-card {
    text-align: right;
}

[dir="rtl"] .profile-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .profile-label {
    text-align: left;
}

[dir="rtl"] .profile-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .action-section {
    text-align: right;
}

[dir="rtl"] .demo-notice {
    text-align: right;
}

[dir="rtl"] .form-actions {
    flex-direction: row-reverse;
}

/* ==========================================================================
   34. Access Badges (User Management)
   ========================================================================== */
.access-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 500;
}

.access-badge.company {
    background: #e3f2fd;
    color: #1565c0;
}

.access-badge.estate {
    background: #e8f5e9;
    color: #2e7d32;
}

.access-badge.building-part {
    background: #fff3e0;
    color: #e65100;
}

.access-badge.none {
    background: #f5f5f5;
    color: #9e9e9e;
}

/* ==========================================================================
   35. Resident Views
   ========================================================================== */
.apartment-details {
    margin-top: 15px;
}

.apartment-details p {
    margin-bottom: 8px;
}

.section-header {
    margin: 30px 0 15px;
}

.section-header h3 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.section-header-light h3 {
    color: white;
    border-bottom-color: white;
}

.measure-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.measure-point-card {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.measure-point-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.measure-point-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.measure-point-header h4 {
    margin: 0;
    color: var(--text-dark);
}

.meter-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--border-radius);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--primary-gradient);
    color: white;
}

.measure-point-details {
    margin-bottom: 15px;
}

.measure-point-details p {
    margin: 5px 0;
    font-size: 14px;
    color: var(--text-light);
}

.measure-point-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    align-items: center;
}

.measure-point-info span {
    font-size: 14px;
    color: var(--text-light);
}

.measure-point-actions {
    text-align: right;
}

.measure-point-actions .btn-primary {
    font-size: 13px;
    padding: 8px 16px;
    min-height: 36px;
}

/* ==========================================================================
   36. Resident Table Styles
   ========================================================================== */
.resident-table {
    margin-top: 15px;
}

.meter-code-small {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.measurement-value {
    font-weight: 500;
}

.measurement-value .value-number {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 600;
}

.measurement-value .value-unit {
    font-size: 12px;
    color: var(--text-light);
    margin-left: 4px;
}

.measurement-value .no-data,
td .no-data {
    color: var(--text-light);
    font-style: italic;
}

.btn-view {
    display: inline-block;
    padding: 6px 12px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-view:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-button);
    color: white;
}

/* ==========================================================================
   37. RTL Resident Views
   ========================================================================== */
[dir="rtl"] .measure-point-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .measure-point-actions {
    text-align: left;
}

[dir="rtl"] .measure-point-info {
    flex-direction: row-reverse;
}

[dir="rtl"] .measurement-value .value-unit {
    margin-left: 0;
    margin-right: 4px;
}

/* ==========================================================================
   38. Company/Site Info Cards (Role-based Dashboards)
   ========================================================================== */
.entity-info-card {
    background: var(--bg-white);
    padding: 25px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    margin-bottom: 20px;
}

.entity-info-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    font-size: 1.1rem;
}

.entity-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.entity-info-item {
    display: flex;
    flex-direction: column;
}

.entity-info-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.entity-info-value {
    font-size: 16px;
    color: var(--text-dark);
    font-weight: 500;
}

/* RTL Support for Entity Info Cards */
[dir="rtl"] .entity-info-card {
    text-align: right;
}

[dir="rtl"] .entity-info-grid {
    direction: rtl;
}

/* ==========================================================================
   39. Consumption Tabs
   ========================================================================== */
.consumption-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
    background: var(--bg-white);
    padding: 0 15px;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: var(--text-light);
    transition: color 0.2s, border-color 0.2s;
    text-decoration: none;
    width: auto;
    font-size: 14px;
}

.tab-btn:hover {
    color: var(--primary-color);
    transform: none;
    box-shadow: none;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ==========================================================================
   40. Period Selector
   ========================================================================== */
.period-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.period-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-medium);
    font-size: 14px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    text-decoration: none;
    width: auto;
}

.period-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: none;
    box-shadow: none;
}

.period-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.period-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-white);
    font-size: 14px;
    cursor: pointer;
    min-width: 120px;
}

.period-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ==========================================================================
   41. Consumption Table Container
   ========================================================================== */
.consumption-table-container {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.consumption-table-container .welcome-card {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

/* Consumption value styling */
.consumption-value {
    color: #28a745;
}

.reading-date {
    font-size: 11px;
    color: var(--text-light);
}

/* ==========================================================================
   42. RTL Support for Consumption Views
   ========================================================================== */
[dir="rtl"] .consumption-tabs {
    flex-direction: row-reverse;
}

[dir="rtl"] .period-selector {
    flex-direction: row-reverse;
}

[dir="rtl"] .tab-btn {
    direction: rtl;
}

/* ==========================================================================
   43. Responsive Consumption Views
   ========================================================================== */
@media (max-width: 768px) {
    .consumption-tabs {
        flex-wrap: wrap;
        padding: 10px;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1;
        text-align: center;
    }

    .period-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .period-btn {
        text-align: center;
    }

    .period-select {
        width: 100%;
    }
}

/* ==========================================================================
   44. Bulk Import Styles
   ========================================================================== */
.bulk-import-card {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-light);
    margin-bottom: 20px;
}

.bulk-import-card h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
}

.form-section {
    padding: 10px 0;
}

.form-section h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
}

.form-section h4 {
    margin: 20px 0 10px 0;
    color: var(--text-medium);
}

.json-preview-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.json-preview {
    background: #f8f9fa;
    padding: 15px;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-dark);
}

.json-example {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    white-space: pre;
    overflow-x: auto;
    margin-bottom: 15px;
    border: 1px solid var(--border-light);
}

.preview-summary {
    padding: 10px 15px;
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: var(--border-radius);
    color: var(--info-text);
    margin-bottom: 15px;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-light);
}

.form-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.format-reference {
    margin-top: 10px;
}

.format-notes {
    margin-top: 15px;
}

.format-notes p {
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-medium);
}

.result-success {
    padding: 15px;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    border-radius: var(--border-radius);
    color: var(--success-text);
}

.result-success ul {
    margin: 10px 0 0 20px;
}

.result-success li {
    margin-bottom: 5px;
}

.result-errors {
    padding: 15px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: var(--border-radius);
    color: var(--danger-text);
}

.result-errors ul {
    margin: 10px 0 0 20px;
    max-height: 300px;
    overflow-y: auto;
}

.result-errors li {
    margin-bottom: 5px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
}

input[type="file"].form-control {
    padding: 8px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
}

input[type="file"].form-control:hover {
    border-color: var(--primary-color);
}

/* ==========================================================================
   45. Loading Spinner
   ========================================================================== */
@keyframes tix-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 64px;
    height: 64px;
    border: 5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: tix-spin 0.8s linear infinite;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 30vh;
    padding: 40px 20px;
    gap: 16px;
    color: var(--text-light);
    font-size: 15px;
}

/* Fullscreen overlay for slow page navigations */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.75);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 15px;
    color: var(--text-light);
    font-size: 15px;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .loading-spinner {
    width: 72px;
    height: 72px;
    border-width: 6px;
}

/* ==========================================================================
   46. Dashboard page: Light text on blue background (outside cards)
   ========================================================================== */

/* Base: light text for content sitting on the blue gradient/wave background */
body.dashboard-page .container {
    color: rgba(255, 255, 255, 0.9);
}

body.dashboard-page .container h1,
body.dashboard-page .container h2,
body.dashboard-page .container h3,
body.dashboard-page .container h4 {
    color: #ffffff;
}

body.dashboard-page .container label {
    color: rgba(255, 255, 255, 0.85);
}

body.dashboard-page .subtitle {
    color: rgba(255, 255, 255, 0.75);
}

/* Links on the background (back-links, nav links without button classes) */
body.dashboard-page .container a:not([class]) {
    color: #b0cbff;
}

body.dashboard-page .container a:not([class]):hover {
    color: #ffffff;
}

body.dashboard-page .container .back-link {
    color: #b0cbff;
}

body.dashboard-page .container .back-link:hover {
    color: #ffffff;
}

/* Form inputs keep dark text on their white backgrounds */
body.dashboard-page .container input,
body.dashboard-page .container select,
body.dashboard-page .container textarea {
    color: var(--text-dark);
}

/* Section header borders become light on blue background */
body.dashboard-page .section-header h3 {
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

/* Loading / empty states on the background */
body.dashboard-page .loading-container {
    color: rgba(255, 255, 255, 0.8);
}

/* Override inline color on empty-state divs */
body.dashboard-page #residentUsersEmpty,
body.dashboard-page #noFilterResults {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* --- Reset: card/panel elements with their own white/colored backgrounds --- */
body.dashboard-page .welcome-card,
body.dashboard-page .card,
body.dashboard-page .stat-card,
body.dashboard-page .users-table,
body.dashboard-page .profile-card,
body.dashboard-page .entity-info-card,
body.dashboard-page .bulk-import-card,
body.dashboard-page .action-section,
body.dashboard-page .page-header,
body.dashboard-page .consumption-table-container,
body.dashboard-page .consumption-tabs,
body.dashboard-page .measure-point-card,
body.dashboard-page .modal-content {
    color: var(--text-dark);
}

body.dashboard-page .admin-section {
    color: var(--warning-text);
}

body.dashboard-page .demo-notice {
    color: var(--info-text);
}

/* Alert text colors (override container inheritance) */
body.dashboard-page .alert-success { color: var(--success-text); }
body.dashboard-page .alert-danger { color: var(--danger-text); }
body.dashboard-page .alert-warning { color: var(--warning-text); }
body.dashboard-page .alert-info { color: var(--info-text); }

/* Headings inside cards reset to their original colors */
body.dashboard-page .welcome-card h2,
body.dashboard-page .welcome-card h3,
body.dashboard-page .page-header h2,
body.dashboard-page .bulk-import-card h3,
body.dashboard-page .modal-header h3,
body.dashboard-page .card h3,
body.dashboard-page .measure-point-card h3,
body.dashboard-page .measure-point-card h4,
body.dashboard-page .form-section h3,
body.dashboard-page .form-section h4 {
    color: var(--text-dark);
}

body.dashboard-page .stat-card h3,
body.dashboard-page .entity-info-card h3,
body.dashboard-page .action-section h3 {
    color: var(--primary-color);
}

body.dashboard-page .admin-section h3 {
    color: var(--warning-text);
}

body.dashboard-page .demo-notice h3 {
    color: var(--info-text);
}

/* Labels inside cards/modals reset to dark */
body.dashboard-page .modal-content label,
body.dashboard-page .bulk-import-card label,
body.dashboard-page .profile-card label,
body.dashboard-page .users-table label,
body.dashboard-page .card label,
body.dashboard-page .welcome-card label {
    color: var(--text-medium);
}

/* Links inside cards reset to standard link color */
body.dashboard-page .welcome-card a:not([class]),
body.dashboard-page .card a:not([class]),
body.dashboard-page .action-section a:not([class]),
body.dashboard-page .profile-card a:not([class]),
body.dashboard-page .modal-content a:not([class]) {
    color: var(--primary-color);
}

body.dashboard-page .welcome-card a:not([class]):hover,
body.dashboard-page .card a:not([class]):hover,
body.dashboard-page .action-section a:not([class]):hover,
body.dashboard-page .profile-card a:not([class]):hover,
body.dashboard-page .modal-content a:not([class]):hover {
    color: var(--primary-dark);
}

/* Back-links inside cards/page-headers reset to visible colors on white */
body.dashboard-page .page-header .back-link,
body.dashboard-page .welcome-card .back-link,
body.dashboard-page .card .back-link,
body.dashboard-page .action-section .back-link {
    color: var(--primary-color);
}

body.dashboard-page .page-header .back-link:hover,
body.dashboard-page .welcome-card .back-link:hover,
body.dashboard-page .card .back-link:hover,
body.dashboard-page .action-section .back-link:hover {
    color: var(--primary-dark);
}

/* Admin section links: dark on the light yellow background */
body.dashboard-page .admin-section a:not([class]) {
    color: #1a3a6b;
}

body.dashboard-page .admin-section a:not([class]):hover {
    color: #000;
}

/* ==========================================================================
   47. Resident Consumption Bar Chart
   ========================================================================== */

.consumption-chart-card {
    padding: 20px;
}

.chart-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.chart-tab {
    padding: 8px 16px;
    border: none;
    background: var(--bg-light);
    color: var(--text-medium);
    cursor: pointer;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-family: var(--font-family);
    transition: background 0.2s, color 0.2s;
}

.chart-tab:hover {
    background: #e0e4ea;
    color: var(--text-dark);
}

.chart-tab.active {
    background: var(--primary-color);
    color: #fff;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-medium);
}

.chart-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

.chart-scroll-container {
    overflow-x: auto;
    padding-bottom: 8px;
}

.chart-bars-area {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    min-height: 200px;
    height: 200px;
    padding-top: 24px;
    position: relative;
}

.chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 36px;
    flex: 1;
}

.chart-bar-stack {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 180px;
    position: relative;
}

.chart-bar {
    width: 18px;
    min-height: 0;
    border-radius: 3px 3px 0 0;
    transition: height 0.4s ease;
    position: relative;
}

.chart-bar:hover {
    opacity: 0.85;
}

.chart-bar-value {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-medium);
    white-space: nowrap;
    display: none;
}

.chart-bar:hover .chart-bar-value {
    display: block;
}

.chart-bar-label {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
}

.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-light);
    font-size: 14px;
}

.chart-loading .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: chartSpin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes chartSpin {
    to { transform: rotate(360deg); }
}

.chart-no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-light);
    font-size: 14px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chart-tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .chart-bar-group {
        min-width: 28px;
    }

    .chart-bar {
        width: 12px;
    }

    .consumption-chart-card {
        padding: 12px;
    }

    .chart-bars-area {
        min-height: 160px;
        height: 160px;
    }

    .chart-bar-stack {
        height: 140px;
    }
}

/* RTL support */
[dir="rtl"] .chart-scroll-container {
    direction: rtl;
}

[dir="rtl"] .chart-bars-area {
    flex-direction: row-reverse;
}

[dir="rtl"] .chart-legend {
    flex-direction: row-reverse;
}

[dir="rtl"] .chart-loading .spinner {
    margin-right: 0;
    margin-left: 10px;
}

/* ==========================================================================
   48. User Dropdown (Navbar)
   ========================================================================== */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    width: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s;
}

.user-dropdown-btn:hover {
    opacity: 0.85;
    transform: none;
    box-shadow: none;
}

.user-dropdown-arrow {
    font-size: 10px;
    display: inline-block;
    transition: transform 0.2s;
}

.user-dropdown.open .user-dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    min-width: 160px;
    z-index: 200;
    overflow: hidden;
}

.user-dropdown.open .user-dropdown-menu {
    display: block;
}

.user-dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    transition: background 0.15s;
}

.user-dropdown-menu a:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

[dir="rtl"] .user-dropdown-menu {
    right: auto;
    left: 0;
}

/* ==========================================================================
   49. History Dropdown (Measure Points table)
   ========================================================================== */

.hist-dropdown {
    position: relative;
    display: inline-block;
}

.hist-dropdown-menu {
    display: none;
    position: fixed;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    min-width: 195px;
    z-index: 100;
    overflow: hidden;
}

.hist-dropdown.open .hist-dropdown-menu {
    display: block;
}

.hist-dropdown-menu a {
    display: block;
    padding: 8px 14px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.15s;
}

.hist-dropdown-menu a:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* ==========================================================================
   50. History Modal
   ========================================================================== */

.hist-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hist-modal-overlay.open {
    display: flex;
}

.hist-modal {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-medium);
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hist-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.hist-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-dark);
    word-break: break-word;
}

.hist-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 0 0 12px;
    width: auto;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.hist-modal-close:hover {
    color: var(--text-dark);
    transform: none;
    box-shadow: none;
}

.hist-modal-body {
    overflow-y: auto;
    flex: 1;
}

.hist-modal-no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 14px;
}

.hist-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.hist-modal-table th,
.hist-modal-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-light);
}

.hist-modal-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-medium);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.hist-modal-table th.period-col,
.hist-modal-table td.period-col {
    text-align: left;
    white-space: nowrap;
    width: 90px;
    color: var(--text-medium);
}

.hist-modal-table th.value-col,
.hist-modal-table td.value-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.hist-modal-table tr.total-row td {
    font-weight: 700;
    border-top: 2px solid var(--border-color);
    background: var(--bg-light);
    border-bottom: none;
}

.hist-modal-table tbody tr:last-child td {
    border-bottom: none;
}

.hist-modal-table tbody tr:hover td {
    background: var(--bg-light);
}
