:root {
    color-scheme: light;
    --theme-bg: #f4f7fb;
    --theme-surface: #ffffff;
    --theme-surface-muted: #eef3f8;
    --theme-surface-strong: #dce7f2;
    --theme-border: #ccd7e3;
    --theme-text: #1f2d3d;
    --theme-text-muted: #5f7287;
    --theme-link: #0f5e9c;
    --theme-link-hover: #0a4776;
    --theme-navbar-bg: #12324a;
    --theme-navbar-text: #dce7f2;
    --theme-navbar-hover: #ffffff;
    --theme-navbar-border-soft: rgba(220, 231, 242, 0.25);
    --theme-navbar-border-strong: rgba(220, 231, 242, 0.2);
    --theme-navbar-menu-bg: #ffffff;
    --theme-navbar-menu-border: #ccd7e3;
    --theme-navbar-menu-text: #1f2d3d;
    --theme-navbar-menu-hover-bg: #eef3f8;
    --theme-navbar-menu-hover-text: #0a4776;
    --theme-sidebar-bg: #dde6ef;
    --theme-sidebar-title: #31475d;
    --theme-sidebar-link: #17324d;
    --theme-sidebar-active-bg: #c0d2e4;
    --theme-sidebar-active-text: #0a2740;
    --theme-table-stripe: #f9fbfd;
    --theme-shadow: 0 18px 44px rgba(15, 39, 63, 0.08);
    --theme-input-bg: #ffffff;
    --theme-input-text: #1f2d3d;
    --theme-input-border: #b9c8d8;
    --theme-placeholder: #7f8ea0;
    --theme-overlay: rgba(8, 20, 32, 0.55);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --theme-bg: #0f1722;
    --theme-surface: #172331;
    --theme-surface-muted: #1d2d3d;
    --theme-surface-strong: #243649;
    --theme-border: #32475c;
    --theme-text: #e4edf6;
    --theme-text-muted: #a6b7c8;
    --theme-link: #7fc6ff;
    --theme-link-hover: #b3dcff;
    --theme-navbar-bg: #09121b;
    --theme-navbar-text: #c2d4e5;
    --theme-navbar-hover: #ffffff;
    --theme-navbar-border-soft: rgba(194, 212, 229, 0.25);
    --theme-navbar-border-strong: rgba(194, 212, 229, 0.2);
    --theme-navbar-menu-bg: #1c2b38;
    --theme-navbar-menu-border: rgba(210, 224, 236, 0.12);
    --theme-navbar-menu-text: #dce7f2;
    --theme-navbar-menu-hover-bg: #495057;
    --theme-navbar-menu-hover-text: #ffffff;
    --theme-sidebar-bg: #111b26;
    --theme-sidebar-title: #8ea4b8;
    --theme-sidebar-link: #d4e3f1;
    --theme-sidebar-active-bg: #1f3650;
    --theme-sidebar-active-text: #ffffff;
    --theme-table-stripe: #14202b;
    --theme-shadow: 0 20px 44px rgba(0, 0, 0, 0.35);
    --theme-input-bg: #101925;
    --theme-input-text: #e4edf6;
    --theme-input-border: #395067;
    --theme-placeholder: #7f93a7;
    --theme-overlay: rgba(2, 8, 15, 0.78);
}

html,
body {
    background: var(--theme-bg);
    color: var(--theme-text);
}

body {
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: var(--theme-link);
}

a:hover {
    color: var(--theme-link-hover);
}

.navbar.navbar-dark.bg-dark {
    background: #12324a !important;
    background: linear-gradient(90deg, var(--theme-navbar-bg), color-mix(in srgb, var(--theme-navbar-bg) 78%, var(--theme-surface) 22%)) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.navbar-dark .navbar-nav .nav-link,
.navbar-dark .navbar-toggler,
.navbar-dark .dropdown-toggle,
.navbar-dark .navbar-brand {
    color: var(--theme-navbar-text) !important;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus,
.navbar-dark .navbar-brand:hover {
    color: var(--theme-navbar-hover) !important;
}

.navbar-dark .navbar-toggler {
    border-color: rgba(220, 231, 242, 0.35);
    border-color: color-mix(in srgb, var(--theme-navbar-text) 35%, transparent);
}

.nav-theme-item {
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
}

.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(220, 231, 242, 0.25);
    border: 1px solid var(--theme-navbar-border-soft);
    border: 1px solid color-mix(in srgb, var(--theme-navbar-text) 25%, transparent);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    background: color-mix(in srgb, var(--theme-navbar-bg) 68%, var(--theme-surface) 32%);
    color: var(--theme-navbar-text);
}

.theme-switcher-label {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.theme-switcher-select {
    border: 1px solid rgba(220, 231, 242, 0.2);
    border: 1px solid var(--theme-navbar-border-strong);
    border: 1px solid color-mix(in srgb, var(--theme-navbar-text) 20%, transparent);
    background: rgba(9, 18, 27, 0.72);
    background: color-mix(in srgb, var(--theme-navbar-bg) 82%, var(--theme-surface) 18%);
    color: var(--theme-navbar-hover);
    border-radius: 999px;
    padding: 0.15rem 1.8rem 0.15rem 0.55rem;
    font-size: 0.875rem;
    line-height: 1.2;
    cursor: pointer;
}

.theme-switcher-select:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(15, 94, 156, 0.3);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--theme-link) 30%, transparent);
}

.sidebar-layout-body,
.sidebar-menu,
.main-content-with-sidebar,
.container-fluid,
.card,
.modal-content,
.dropdown-menu,
.alert,
.list-group-item,
.change-card,
.email-template-card {
    color: var(--theme-text);
}

.sidebar-menu {
    background: #f1f5f9;
    background: var(--theme-sidebar-bg);
    border-right: 1px solid var(--theme-border);
}

.sidebar-menu .sidebar-section-title {
    color: var(--theme-sidebar-title);
}

.sidebar-menu .sidebar-link {
    color: var(--theme-sidebar-link);
    border-radius: 10px;
}

.sidebar-menu .sidebar-link:hover {
    background: var(--theme-surface-muted);
    color: var(--theme-link-hover);
}

.sidebar-menu .sidebar-link.active {
    background: var(--theme-sidebar-active-bg);
    color: var(--theme-sidebar-active-text);
}

.breadcrumb-nav {
    background: transparent;
}

.breadcrumb-nav ol {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow);
}

.breadcrumb-nav .active,
.muted,
.text-muted,
.change-date {
    color: var(--theme-text-muted) !important;
}

.table,
table,
.card,
.modal-content,
.dropdown-menu,
.list-group-item,
.change-card,
.email-template-card,
.time-report-total,
.time-report-summary .card-body {
    background-color: var(--theme-surface);
    border-color: var(--theme-border);
    box-shadow: var(--theme-shadow);
}

.table,
table,
.table th,
.table td,
table th,
table td,
.card,
.card-header,
.card-footer,
.modal-header,
.modal-footer,
.dropdown-item,
.list-group-item {
    color: var(--theme-text);
    border-color: var(--theme-border);
}

.table thead th,
table thead th,
.card-header,
.modal-header,
.dropdown-header {
    background: var(--theme-surface-muted);
}

.table-striped tbody tr:nth-of-type(odd),
table.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--theme-table-stripe);
}

.table-hover tbody tr:hover,
table.table-hover tbody tr:hover {
    background-color: var(--theme-surface-muted);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--theme-surface-muted);
    color: var(--theme-link-hover);
}

.form-control,
.custom-select,
textarea,
select {
    background-color: var(--theme-input-bg) !important;
    color: var(--theme-input-text) !important;
    border-color: var(--theme-input-border) !important;
}

.form-control:focus,
.custom-select:focus,
textarea:focus,
select:focus {
    background-color: var(--theme-input-bg) !important;
    color: var(--theme-input-text) !important;
    border-color: var(--theme-link) !important;
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--theme-link) 25%, transparent) !important;
}

.form-control::placeholder,
textarea::placeholder {
    color: var(--theme-placeholder);
}

.input-group-text {
    background: var(--theme-surface-muted);
    color: var(--theme-text);
    border-color: var(--theme-input-border) !important;
}

.modal-backdrop.show {
    opacity: 1;
    background: var(--theme-overlay);
}

.btn-light {
    background-color: var(--theme-surface-muted);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

.btn-light:hover,
.btn-light:focus {
    background-color: var(--theme-surface-strong);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

.change-card {
    background: var(--theme-surface);
    border-color: var(--theme-border);
    box-shadow: var(--theme-shadow);
}

.change-card-header {
    border-bottom-color: var(--theme-link);
}

.change-card-header h3 a {
    color: var(--theme-link);
}

.change-card-header h3 a:hover {
    color: var(--theme-link-hover);
}

.info-row {
    border-bottom-color: var(--theme-border);
}

.info-label {
    color: var(--theme-text-muted);
}

.info-value {
    color: var(--theme-text);
}

@media (max-width: 768px) {
    .nav-theme-item {
        margin: 0.75rem 0;
    }

    .theme-switcher {
        width: 100%;
        justify-content: space-between;
    }

    .theme-switcher-select {
        min-width: 9.5rem;
    }
}

#cookie-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;
    line-height: 60px;
    background-color: #f5f5f5;
}

html[data-theme="dark"] #cookie-footer {
    background-color: #1d2d3d;
    border-top: 1px solid #32475c;
}

.button-spacing {
    margin-bottom: 10px;
}

.header-logo {
    margin-right: 35px;
    margin-left: 150px;
    padding-bottom: 35px;
}

.site-header {
    font-size: 2.5rem;  /* Font size for display-5 */
    font-weight: 300;   /* Lighter font weight for a sleek look */
    line-height: 1.3;   /* Line height for proper spacing */
}

.site-sub-text {
    font-size: 1.0rem;  /* Slightly larger than body text but much smaller than the header */
    font-weight: 400;    /* Regular weight to differentiate from the lighter header */
    line-height: 1.0;    /* Comfortable line spacing for readability */
    padding-bottom: 35px; 
}

/* Apply top border to header cells // selectKeys // Custom CSS to style the underline for each cell */
.underline-header {
    border-top: 2px solid var(--theme-border);
}

/* Apply top border to data cells */
.underline-cell {
    border-top: 1px solid var(--theme-border);
}

/* Optional: Remove bottom borders to only have underlining effect */
table th, table td {
    border-bottom: none;
}

/* Style for the title "Nyckelhantering" in the navbar */
.navbar-brand {
    color: var(--theme-navbar-text) !important;
    font-size: 1.25rem; /* Match the font size of other navbar items */
    font-weight: 400; /* Normal font weight */
}

/* Hover effect for the title */
.navbar-brand:hover {
    color: var(--theme-navbar-hover) !important;
}

/* Use explicit theme colors for navbar dropdowns so older Safari versions do not
   fall back to unreadable system menu colors in light mode. */
.navbar.navbar-dark .dropdown-menu,
.navbar-dark .dropdown-menu {
    background-color: var(--theme-navbar-menu-bg) !important;
    border: 1px solid var(--theme-navbar-menu-border) !important;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
}

/* Navbar dropdown menu items */
.navbar.navbar-dark .dropdown-menu .dropdown-item,
.navbar-dark .dropdown-menu .dropdown-item {
    color: var(--theme-navbar-menu-text) !important;
}

.navbar.navbar-dark .dropdown-menu .dropdown-item:hover,
.navbar.navbar-dark .dropdown-menu .dropdown-item:focus,
.navbar-dark .dropdown-menu .dropdown-item:hover,
.navbar-dark .dropdown-menu .dropdown-item:focus {
    color: var(--theme-navbar-menu-hover-text) !important;
    background-color: var(--theme-navbar-menu-hover-bg) !important;
}

.navbar.navbar-dark .dropdown-menu .dropdown-item.active,
.navbar-dark .dropdown-menu .dropdown-item.active {
    color: var(--theme-navbar-menu-hover-text) !important;
    background-color: var(--theme-navbar-menu-hover-bg) !important;
}

html[data-theme="light"] .navbar.navbar-dark.bg-dark {
    background: #12324a !important;
}

html[data-theme="light"] .navbar.navbar-dark .navbar-brand,
html[data-theme="light"] .navbar.navbar-dark .navbar-nav .nav-link,
html[data-theme="light"] .navbar.navbar-dark .dropdown-toggle {
    color: #dce7f2 !important;
}

html[data-theme="light"] .navbar.navbar-dark .navbar-brand:hover,
html[data-theme="light"] .navbar.navbar-dark .navbar-nav .nav-link:hover,
html[data-theme="light"] .navbar.navbar-dark .navbar-nav .nav-link:focus,
html[data-theme="light"] .navbar.navbar-dark .dropdown-toggle:hover,
html[data-theme="light"] .navbar.navbar-dark .dropdown-toggle:focus {
    color: #ffffff !important;
}

html[data-theme="light"] .navbar.navbar-dark .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #ccd7e3 !important;
}

html[data-theme="light"] .navbar.navbar-dark .dropdown-menu .dropdown-item {
    color: #1f2d3d !important;
}

html[data-theme="light"] .navbar.navbar-dark .dropdown-menu .dropdown-item:hover,
html[data-theme="light"] .navbar.navbar-dark .dropdown-menu .dropdown-item:focus,
html[data-theme="light"] .navbar.navbar-dark .dropdown-menu .dropdown-item.active {
    color: #0a4776 !important;
    background-color: #eef3f8 !important;
}

html[data-theme="dark"] .navbar.navbar-dark .dropdown-menu {
    background-color: #1c2b38 !important;
    border: 1px solid rgba(210, 224, 236, 0.12) !important;
}

html[data-theme="dark"] .navbar.navbar-dark .dropdown-menu .dropdown-item {
    color: #dce7f2 !important;
}

html[data-theme="dark"] .navbar.navbar-dark .dropdown-menu .dropdown-item:hover,
html[data-theme="dark"] .navbar.navbar-dark .dropdown-menu .dropdown-item:focus,
html[data-theme="dark"] .navbar.navbar-dark .dropdown-menu .dropdown-item.active {
    color: #ffffff !important;
    background-color: #495057 !important;
}


.centered-content {
   /* margin-left: 26%; */ /* Adjust this value as needed */
   /*  margin-right: 20%; */ /* Adjust this value as needed */
    text-align: center;  /* Left-align the text */
}

.centered-contentLoginButton {
    margin-left: auto;   /* Center horizontally */
    margin-right: auto;  /* Center horizontally */
    /*text-align: center;*/  /* Center the content text */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align items towards the top of the container */
    padding-top: 20px; /* Set a 2 cm gap from the top */
    padding-bottom: 20px; /* Optional: Add padding to the bottom */
    min-height: auto; /* No need for 100vh; let the content define the height */
}

.form-container {
    display: flex;
    justify-content: center;
    align-items: center;
}


/* Custom styles for nested dropdowns (in the menu) */
/* Styles for nested dropdowns */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -1px;
}

/* allTasks column width settings */

/* Stretch the table to 80% width and center it */
.wider-table {
    width: 80% !important;
    margin: 0 auto; !important; /* Center horizontally */
    table-layout: auto; !important;/* Allow columns to adjust based on content */
}

/* Avoid double centering when tables are already wrapped in a header-container */
.header-container .wider-table {
    width: 100% !important;
    margin: 0 !important;
}

/* Ensure text wraps and avoid overflow */
.wider-table th,
.wider-table td {
    word-wrap: break-word;
    text-align: left;
}

/* Optional: Improve appearance on smaller screens */
@media (max-width: 768px) {
    .wider-table {
        width: 100%; /* Use full screen width on smaller screens */
    }

    .narrow-table {
        width: 100%; /* Use full screen width on smaller screens */
    }

    .header-container {
        width: 100%; /* Use full screen width on smaller screens */
    }

    .narrow-header-container {
        width: 100%; /* Use full screen width on smaller screens */
    }

    .time-report-actions {
        width: 100%;
    }

}

/* Ensure the header container matches the table width */
.header-container {
    display: flex;
    justify-content: space-between; /* Push header left and button right */
    align-items: center; /* Vertically align header and button */
    width: 80%; /* Match table width */
    margin: 0 auto; /* Center the container horizontally */
    margin-bottom: 1rem; /* Add spacing below the container */
}

.narrow-header-container {
    display: flex;
    justify-content: space-between; /* Push header left and button right */
    align-items: center; /* Vertically align header and button */
    width: 59%; /* Match table width */
    margin: 0 auto; /* Center the container horizontally */
    margin-bottom: 1rem; /* Add spacing below the container */
}

.narrow-table {
    width: 59%;
    margin: 0 auto; /* Center horizontally */
    table-layout: auto; /* Allow columns to adjust based on content */
}

.page-content-shell {
    width: 80%;
    max-width: 100%;
    margin: 0 auto;
}

.page-content-shell--narrow {
    width: 59%;
}

/* Optional: Add consistent spacing around the header button */
#registerButton {
    margin-left: auto; /* Push the button to the far right */
}


/* Formatting for completed tasks */
.completed-task {
    background-color: #28a745; /* Green for completed rows */
    color: #fff;
    font-weight: bold;        /* Make text bold */
    text-decoration: line-through; /* Strike-through for clarity */
}

.ongoing-task {
    background-color: #ffc107; /* Yellow */
    color: #000;
}

/* Add padding to the navigation buttons in the pages. */
.navigation-link {
    margin-left: 10px; /* Add space to the left */
    margin-right: 10px; /* Add space to the right */
}

/* Add padding to the navigation buttons in the pages. */
.navigation-link-right-padding {
    margin-right: 10px; /* Add space to the right */
}

.form-inline .btn {
    margin-right: 10px;
}

/* Normalize + Registrera button sizing across views */
.btn-register {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    white-space: nowrap;
    min-height: calc(1.5em + 0.75rem + 2px);
}

/* Time report button alignment and primary action color */
.time-report-actions {
    width: 80%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0 0.75rem;
}

.btn-close-months {
    background-color: #1f6f78;
    border-color: #1f6f78;
    color: #fff;
}

.btn-close-months:hover,
.btn-close-months:focus {
    background-color: #195b62;
    border-color: #195b62;
    color: #fff;
}

.btn-close-months:disabled,
.btn-close-months.disabled {
    background-color: #9cc7cb;
    border-color: #9cc7cb;
    color: #1f2d2f;
    opacity: 1;
}

.wysiwyg-toolbar {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.wysiwyg-editor {
    min-height: 170px;
    overflow-y: auto;
}

.email-template-card {
    background: var(--theme-surface-muted);
}

.time-report-total {
    width: 80%;
    margin: 0 auto 1rem;
    background-color: var(--theme-surface-muted);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

.time-report-warning {
    width: 80%;
    margin: 0 auto 1rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.time-report-summary,
.time-report-footer {
    width: 80%;
    margin: 0 auto 1rem;
}

.time-report-table {
    width: 80%;
    margin: 0 auto 1rem;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

.time-report-summary,
.time-report-footer,
.time-report-warning,
.time-report-actions,
.time-report-header {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.time-report-summary .card-header,
.time-report-summary .card-body {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.time-report-footer {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.time-report-table .table {
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
}

.time-report-table .table th,
.time-report-table .table td {
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
}


/* Fix size and positioning of register button in receipts view */
/* Ensure consistent button heights */
.btn {
    display: inline-block; /* Ensure buttons behave consistently */
    vertical-align: middle; /* Aligns buttons correctly */
    padding: 0.375rem 0.75rem; /* Standardize padding */
    font-size: 1rem; /* Standardize font size */
    line-height: 1.5; /* Standardize line height */
    border-radius: 0.25rem; /* Standardize border radius */
    height: auto; /* Allow height to adjust consistently */
}

/* Specific fix for <a> tags styled as buttons */
a.btn {
    display: inline-flex; /* Match button behavior */
    align-items: center; /* Center content vertically */
    justify-content: center; /* Center content horizontally */
    text-decoration: none; /* Remove underline */
}

/* Ensure proper alignment for all elements in the flex container */
.d-flex.align-items-center {
    align-items: center; /* Vertically align all child elements */
}

/* Ensure consistent alignment for form elements inside the flex container */
.form-inline {
    display: flex; /* Ensure form behaves like a flexbox */
    align-items: center; /* Vertically align form elements */
    margin-bottom: 0; /* Remove default bottom margin to align with buttons */
}

/* Align input and button elements */
.form-control, .form-inline .btn {
    display: inline-block; /* Ensure consistent inline layout */
    vertical-align: middle; /* Align elements vertically */
    height: auto; /* Let the browser calculate height naturally */
}

/* Specific fix for search input padding */
.form-control {
    padding-top: 0.375rem; /* Match button padding */
    padding-bottom: 0.375rem; /* Match button padding */
}

/* Mobile-responsive styles for key management views */
@media (max-width: 768px) {
    /* Hide specific columns on mobile devices */
    .mobile-hide {
        display: none !important;
    }
    
    /* Stack navigation buttons vertically on mobile */
    .mobile-nav-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .mobile-nav-stack > div:first-child {
        margin-bottom: 1rem;
    }
    
    .mobile-nav-stack .navigation-link-right-padding {
        margin-bottom: 0.5rem;
        margin-right: 0.5rem;
        width: auto;
    }
    
    /* Make search form stack better on mobile */
    .mobile-search-stack {
        flex-direction: column !important;
        width: 100%;
    }
    
    .mobile-search-stack .form-inline {
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    .mobile-search-stack .form-inline .form-control {
        width: 100%;
        margin-bottom: 0.5rem;
        margin-right: 0 !important;
    }
    
    .mobile-search-stack .form-inline .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        margin-right: 0 !important;
    }
    
    .mobile-search-stack .btn {
        width: 100%;
    }
    
    /* Improve table overflow on mobile */
    .table-responsive-mobile {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure table doesn't break layout on very small screens */
    .wider-table {
        min-width: 300px;
    }
    
    /* Compact button spacing on mobile */
    .mobile-compact-buttons .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
        margin-right: 0.25rem;
    }

    .time-report-actions,
    .time-report-total,
    .time-report-warning,
    .time-report-summary,
    .time-report-table,
    .time-report-footer {
        width: 100%;
    }

    .time-report-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .time-report-filter label,
    .time-report-filter-input,
    .time-report-filter .btn {
        width: 100%;
    }

    .time-report-summary .card-header,
    .time-report-summary .card-body,
    .time-report-footer {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .time-report-table {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .time-report-table .table th,
    .time-report-table .table td {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Reduce container-fluid padding on larger screens to avoid excessive left/right spacing */
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

/* Ensure tables are properly centered and fit within viewport */
.wider-table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

/* Ensure table cells wrap text properly and don't overflow */
.wider-table td,
.wider-table th {
    white-space: normal;
    overflow-wrap: break-word;
}

.keytag-price-actions {
    white-space: nowrap;
}

.time-report-header {
    padding: 0 0.75rem;
}

.time-report-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.time-report-filter-input {
    width: 110px;
}

.important-date-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.important-date-list-item {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: var(--theme-shadow);
}

.important-date-list-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.important-date-list-main {
    flex: 1;
    min-width: 0;
}

.important-date-title-heading {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
}

.important-date-title-button {
    background: none;
    border: none;
    color: var(--theme-link);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-align: left;
}

.important-date-title-button:hover,
.important-date-title-button:focus {
    color: var(--theme-link-hover);
    text-decoration: underline;
}

.important-date-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.important-date-summary-pill {
    background: var(--theme-surface-muted);
    border: 1px solid var(--theme-border);
    border-radius: 999px;
    color: var(--theme-text-muted);
    display: inline-flex;
    font-size: 0.9rem;
    line-height: 1.2;
    padding: 0.25rem 0.65rem;
}

.important-date-summary-text {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--theme-text);
    display: -webkit-box;
    margin: 0.75rem 0 0;
    overflow: hidden;
}

.important-date-list-actions {
    display: flex;
    justify-content: flex-end;
    min-width: 96px;
}

.important-date-detail-panel,
.important-date-edit-panel {
    background: var(--theme-surface-muted);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    margin-top: 1rem;
    padding: 1rem;
}

.important-date-detail-title {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.important-date-detail-list {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.important-date-detail-field {
    border-bottom: 1px solid var(--theme-border);
    padding-bottom: 0.75rem;
}

.important-date-detail-field:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.important-date-detail-field dt {
    color: var(--theme-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.important-date-detail-field dd {
    color: var(--theme-text);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
/* Intercom Changes Grid Layout */
.intercom-changes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 20px;
    padding: 0;
}

.change-card {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--theme-shadow);
    transition: box-shadow 0.3s ease;
}

.change-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.change-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--theme-link);
}

.change-card-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.change-card-header h3 a {
    color: var(--theme-link);
    text-decoration: none;
}

.change-card-header h3 a:hover {
    color: var(--theme-link-hover);
    text-decoration: underline;
}

.change-date {
    font-size: 0.9rem;
    color: var(--theme-text-muted);
    font-weight: 500;
}

.change-card-body {
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--theme-border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--theme-text-muted);
    min-width: 150px;
}

.info-value {
    color: var(--theme-text);
    text-align: right;
    flex: 1;
    word-break: break-word;
}

.change-card-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.change-card-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Responsive grid for smaller screens */
@media (max-width: 768px) {
    .important-date-list-row {
        flex-direction: column;
    }

    .important-date-list-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .important-date-list-actions .btn {
        width: 100%;
    }

    .intercom-changes-grid {
        grid-template-columns: 1fr;
    }
    
    .info-row {
        flex-direction: column;
    }
    
    .info-label {
        margin-bottom: 5px;
        min-width: auto;
    }
    
    .info-value {
        text-align: left;
    }
    
    .change-card-actions {
        flex-direction: column;
    }
    
    .change-card-actions .btn {
        width: 100%;
    }

    .keytag-price-actions {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }
}

/* Tablet/iPad view (2 columns) */
@media (min-width: 769px) and (max-width: 1024px) {
    .intercom-changes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop view (2 columns) */
@media (min-width: 1025px) {
    .intercom-changes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Left Sidebar Layout Styles */
.sidebar-layout {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

.sidebar-layout-body {
    display: flex;
    flex: 1;
}

.sidebar-menu {
    width: 250px;
    background-color: #f1f5f9;
    background-color: var(--theme-sidebar-bg);
    padding: 20px 0;
    overflow-y: auto;
    position: fixed;
    height: calc(100vh - 56px); /* Account for navbar height */
    top: 56px;
    border-right: 1px solid var(--theme-border);
}

.sidebar-menu .sidebar-section {
    margin-bottom: 20px;
}

.sidebar-menu .sidebar-section-title {
    color: var(--theme-sidebar-title);
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 0 20px;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-menu .sidebar-link {
    display: block;
    color: var(--theme-sidebar-link);
    padding: 10px 20px;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-menu .sidebar-link:hover {
    background-color: var(--theme-surface-muted);
    color: var(--theme-link-hover);
    text-decoration: none;
}

.sidebar-menu .sidebar-link.active {
    background-color: var(--theme-sidebar-active-bg);
    color: var(--theme-sidebar-active-text);
}

/* Investment requests */
.investment-request-create {
    background: var(--theme-surface-muted);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 1rem;
}

.investment-request-card .change-card-header {
    align-items: flex-start;
    gap: 0.5rem;
}

.investment-status-badge {
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    white-space: nowrap;
}

.investment-status-badge.status-nytt {
    background: #e2e3e5;
    color: #383d41;
}

.investment-status-badge.status-pagaende {
    background: #d1ecf1;
    color: #0c5460;
}

.investment-status-badge.status-vantar {
    background: #fff3cd;
    color: #856404;
}

.investment-status-badge.status-slutford {
    background: #d4edda;
    color: #155724;
}

.investment-status-badge.status-avslagen {
    background: #f8d7da;
    color: #721c24;
}

.investment-request-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.investment-inline-form {
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: 0.75rem;
    background: var(--theme-surface);
}

.investment-comments {
    border-top: 1px solid var(--theme-border);
    padding-top: 0.75rem;
}

.investment-comment-list {
    list-style: none;
    margin: 0 0 0.75rem 0;
    padding: 0;
}

.investment-comment-list li {
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.5rem;
}

.investment-comment-meta {
    color: var(--theme-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.board-os-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.board-os-kpi-grid,
.board-os-section-grid {
    display: grid;
    gap: 1rem;
}

.board-os-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.board-os-section-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.board-os-kpi-card,
.board-os-section-card,
.board-os-mobile-card {
    border: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow);
}

.board-os-kpi-label {
    color: var(--theme-text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.board-os-kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 0.35rem 0;
}

.board-os-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem 1rem;
    font-size: 0.92rem;
}

.board-os-prewrap {
    white-space: pre-wrap;
}

.board-os-progress-rail {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--theme-card-bg, #fff);
    border: 1px solid var(--theme-border, #dee2e6);
    border-radius: 0.375rem;
}

.board-os-progress-step {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--theme-text-muted, #6c757d);
    white-space: nowrap;
}

.board-os-progress-step.done {
    color: #198754;
}

.board-os-progress-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: #dee2e6;
    flex-shrink: 0;
    margin-right: 0.35rem;
}

.board-os-progress-step.done .board-os-progress-dot {
    background: #198754;
}

.board-os-progress-connector {
    width: 1.5rem;
    height: 2px;
    background: #dee2e6;
    margin: 0 0.25rem;
    flex-shrink: 0;
}

.board-os-next-action {
    border-left: 4px solid #0d6efd;
    background: #f0f6ff;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
}

.board-os-review-section {
    background: #f8f9fa;
    border: 1px solid var(--theme-border, #dee2e6);
    border-radius: 0.375rem;
    padding: 1rem;
}

.receipt-key-list {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.receipt-detail-shell {
    padding-left: 0;
    padding-right: 0;
}

.property-brain-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.property-brain-kpi-card {
    border: 1px solid var(--theme-border);
    box-shadow: var(--theme-shadow);
}

.property-brain-kpi-label {
    color: var(--theme-text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.property-brain-kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 0.35rem 0;
}

.property-brain-recommendation,
.property-brain-outlier-card,
.property-brain-forecast-card {
    border: 1px solid var(--theme-border);
    border-radius: 14px;
    padding: 1rem;
    background: var(--theme-surface-muted);
}

.property-brain-live-feed {
    display: grid;
    gap: 0.75rem;
}

.property-brain-live-item {
    margin-bottom: 0;
}

/* Important dates */
.important-dates-panel {
    background: var(--theme-surface-muted);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 1rem;
}

.important-date-edit {
    border-top: 1px solid var(--theme-border);
    padding-top: 0.75rem;
}

.important-recipient-card,
.task-admin-mobile-card {
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 0.75rem;
    background: var(--theme-surface);
}

.important-recipient-email {
    font-weight: 600;
    color: var(--theme-text);
}

.task-admin-mobile-card details summary {
    cursor: pointer;
    font-weight: 600;
}

.task-admin-mobile-card .mobile-compact-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.investment-request-create-form .form-group,
.investment-comment-form,
.important-recipient-form,
.task-admin-mobile-form {
    margin-bottom: 0.5rem;
}

.checklist-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.checklist-inline-form {
    min-width: 220px;
}

.checklist-view-switch .btn {
    margin-bottom: 0.35rem;
}

.checklist-completed-table td,
.checklist-completed-table th {
    vertical-align: middle;
}

.checklist-completed-actions {
    white-space: nowrap;
}

.checklist-completed-details-cell {
    background: var(--theme-surface-muted);
}

.checklist-completed-details {
    padding: 0.5rem 0;
}

.checklist-task-details {
    display: block;
    white-space: pre-line;
    line-height: 1.4;
    height: calc(1.4em * 2);
    overflow-y: scroll;
    overflow-x: hidden;
    word-break: break-word;
    padding-right: 0.2rem;
}

.checklist-task-overflow-hint {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.15rem;
}

.checklist-sortable-list {
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    background: var(--theme-surface);
    padding: 0.4rem;
}

.checklist-sortable-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.3rem;
    border: 1px solid var(--theme-border);
    border-radius: 4px;
    background: var(--theme-surface-muted);
    cursor: move;
}

.checklist-sortable-item:last-child {
    margin-bottom: 0;
}

.checklist-sortable-item.dragging {
    opacity: 0.7;
}

.checklist-sortable-item.drag-over {
    border-color: #007bff;
    background: #eaf3ff;
}

.checklist-sortable-handle {
    font-weight: 700;
    color: #6c757d;
    letter-spacing: 1px;
}

.checklist-sortable-title {
    flex: 1;
}

.main-content-with-sidebar {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
    width: calc(100% - 250px);
}

.breadcrumb-nav {
    background-color: var(--theme-surface-muted);
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.breadcrumb-nav ol {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.breadcrumb-nav ol li {
    display: inline;
}

.breadcrumb-nav ol li + li:before {
    content: "/";
    padding: 0 8px;
    color: #6c757d;
}

.breadcrumb-nav a {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-nav a:hover {
    text-decoration: underline;
}

.breadcrumb-nav .active {
    color: #6c757d;
}

.access-workflow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.access-workflow-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    background: #fff;
}

.access-workflow-step h2 {
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.access-workflow-step p {
    margin: 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.access-workflow-number {
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: #0056b3;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile responsiveness for sidebar */
@media (max-width: 768px) {
    .page-content-shell,
    .page-content-shell--narrow {
        width: 100%;
    }

    .sidebar-menu {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
    }
    
    .main-content-with-sidebar {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar-layout-body {
        flex-direction: column;
    }

    .investment-request-actions {
        grid-template-columns: 1fr;
    }

    .investment-request-create-form .btn,
    .investment-comment-form .btn,
    .important-dates-reminder-action .btn,
    .important-recipient-form .btn,
    .task-admin-mobile-form .btn,
    .board-os-subnav .btn {
        width: 100%;
    }

    .checklist-header-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem;
    }

    .checklist-header-actions .btn {
        width: 100%;
    }

    .checklist-inline-actions {
        flex-direction: column;
    }

    .checklist-inline-actions .btn,
    .checklist-inline-form {
        width: 100%;
    }

    .checklist-completed-actions {
        white-space: normal;
    }

    .checklist-completed-actions .btn,
    .checklist-completed-actions form {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .access-workflow {
        grid-template-columns: 1fr;
    }
}


/* Important Dates Modal Styles */
.important-dates-modal {
    z-index: 1050;
}

.important-dates-modal .modal-content {
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.important-dates-modal .modal-header {
    background-color: var(--theme-surface-strong);
    border-bottom: 1px solid var(--theme-border);
    padding: 1rem 1.5rem;
}

.important-dates-modal .modal-title {
    color: var(--theme-text);
    font-weight: 600;
}

.important-dates-modal .modal-body {
    padding: 1.5rem;
    background-color: var(--theme-surface);
}

.important-dates-modal .form-group {
    margin-bottom: 1rem;
}

.important-dates-modal .form-control {
    background-color: var(--theme-input-bg);
    border: 1px solid var(--theme-input-border);
    color: var(--theme-input-text);
}

.important-dates-modal .form-control:focus {
    border-color: var(--theme-link);
    box-shadow: 0 0 0 0.2rem rgba(15, 94, 156, 0.25);
}

.important-dates-modal .modal-footer {
    background-color: var(--theme-surface-muted);
    border-top: 1px solid var(--theme-border);
    padding: 1rem 1.5rem;
}

.important-dates-modal .btn-secondary {
    background-color: var(--theme-surface);
    border: 1px solid var(--theme-border);
    color: var(--theme-text);
}

.important-dates-modal .btn-secondary:hover {
    background-color: var(--theme-surface-strong);
}

.important-dates-modal .btn-primary {
    background-color: var(--theme-link);
    border-color: var(--theme-link);
}

.important-dates-modal .btn-primary:hover {
    background-color: var(--theme-link-hover);
    border-color: var(--theme-link-hover);
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
    .important-dates-modal .modal-dialog {
        margin: 1rem;
        max-width: none;
    }
    
    .important-dates-modal .modal-content {
        border-radius: 4px;
    }
}


/* ---- Floating AI chat widget (mobile + a11y) ---- */
/* Touch target: ensure the FAB and close button meet WCAG 2.5.5 (>= 48x48). */
.app-ai-fab {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
    width: 3.5rem;
    height: 3.5rem;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    box-sizing: border-box;
}
.app-ai-icon-button {
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Visible focus ring for keyboard users (a11y). */
.app-ai-fab:focus-visible,
.app-ai-icon-button:focus-visible,
#app-ai-chat-input:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* iOS Safari: 16px font-size prevents the form auto-zoom on focus. */
#app-ai-chat-input {
    font-size: 16px;
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
    .app-ai-fab,
    .app-ai-panel,
    .app-ai-panel-messages {
        transition: none !important;
        animation: none !important;
    }
}

/* Tablet / small laptop: keep card sizing but cap height. */
@media (max-width: 900px) {
    .app-ai-panel {
        width: min(20rem, calc(100vw - 2rem));
    }
}

/* Phone: collapse to a near-fullscreen bottom sheet so the input is always
   above the iOS / Android keyboard. We honour safe-area insets. */
@media (max-width: 600px) {
    .app-ai-fab {
        position: fixed;
        bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
        right: calc(max(1rem, env(safe-area-inset-right, 1rem)) + 45px);
        z-index: 1000;
    }
    .app-ai-panel {
        position: fixed;
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        width: auto;
        max-height: 75vh;
        border-radius: 1rem;
    }
    .app-ai-panel-messages {
        min-height: 30vh;
        max-height: calc(75vh - 8rem);
        -webkit-overflow-scrolling: touch;
    }
    .app-ai-panel-form {
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    }

    /* Fix header text and logo overflow on small screens */
    .header-logo {
        margin-left: 20px !important;
        margin-right: 15px !important;
    }
    .site-header {
        font-size: 1.5rem !important;
    }
    .site-sub-text {
        font-size: 0.8rem !important;
        padding-bottom: 20px !important;
    }
}

/* Landscape phone: avoid the FAB being clipped by the on-screen keyboard. */
@media (max-height: 500px) and (orientation: landscape) {
    .app-ai-panel {
        max-height: 90vh;
    }
}


/* Touch-only handle indicator (the two small bars above the panel header
   on phones, signalling "swipe down to dismiss"). */
.app-ai-panel-handle {
    display: none;
    margin: 0 .5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: 0.1rem;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
@media (pointer: coarse) {
    .app-ai-panel-header { cursor: grab; }
    .app-ai-panel-handle { display: inline-block; }
    .app-ai-panel-header:active { cursor: grabbing; }
}

/* Screen-reader-only utility (used by the new visually-hidden label). */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* ---- Floating AI chat widget v2: typing indicator, provider badge, suggestions, retry ---- */
.app-chat-typing .app-chat-bubble {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    color: #475569;
    font-style: italic;
}
.app-chat-typing-dots span {
    animation: app-chat-blink 1.2s infinite;
    display: inline-block;
}
.app-chat-typing-dots span:nth-child(2) { animation-delay: .2s; }
.app-chat-typing-dots span:nth-child(3) { animation-delay: .4s; }
.app-chat-typing-label { margin-left: .25rem; }
@keyframes app-chat-blink {
    0%, 80%, 100% { opacity: .2; }
    40% { opacity: 1; }
}

.app-chat-provider-badge {
    display: inline-block;
    margin-left: .5rem;
    padding: .1rem .4rem;
    border-radius: .5rem;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: rgba(15, 118, 110, .15);
    color: #0f766e;
    vertical-align: middle;
}
.app-chat-provider-ai,
.app-chat-provider-ai-legacy { background: rgba(37, 99, 235, .15); color: #1d4ed8; }
.app-chat-provider-rules { background: rgba(15, 118, 110, .15); color: #0f766e; }

.app-chat-timestamp {
    font-size: .65rem;
    color: #64748b;
    margin-top: .15rem;
    display: inline-block;
}
.app-chat-meta { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

.app-chat-action-btn {
    display: inline-block;
    margin-top: .5rem;
    padding: .35rem .65rem;
    border-radius: .5rem;
    background: #1d4ed8;
    color: #fff;
    text-decoration: none;
    font-size: .8rem;
}
.app-chat-action-btn:hover { background: #1e40af; }

.app-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .5rem;
}
.app-chat-suggestion-chip {
    border: 1px solid rgba(15, 118, 110, .4);
    background: rgba(15, 118, 110, .05);
    color: #0f766e;
    border-radius: 999px;
    padding: .25rem .6rem;
    font-size: .75rem;
    cursor: pointer;
    min-height: 32px; /* Still a touch-friendly target on phones */
}
.app-chat-suggestion-chip:hover { background: rgba(15, 118, 110, .12); }
.app-chat-suggestion-chip:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }

.app-chat-retry-btn {
    border: 0;
    background: transparent;
    color: #1d4ed8;
    font-size: .75rem;
    text-decoration: underline;
    cursor: pointer;
    padding: .15rem .35rem;
    min-height: 32px;
}
.app-chat-retry-btn:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }

/* Kundtjanst comment form: hide helper row + info icon tooltip */
.is-hidden { display: none !important; }
.ui-info { cursor: help; color: #17a2b8; margin-left: 4px; font-weight: 600; }
.ui-info[data-ui-tooltip]:hover::after,
.ui-info[data-ui-tooltip]:focus::after {
    content: attr(data-ui-tooltip);
    position: absolute;
    transform: translate(-50%, -8px);
    background: #1f2937;
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.35;
    max-width: 280px;
    width: max-content;
    z-index: 1080;
    white-space: pre-line;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
    pointer-events: none;
}

/* AI chat confirmation mode dropdown (#619). Lives in the panel header
   between the title and the action buttons; small font, neutral colour
   so it doesn't draw attention away from the conversation. */
.app-ai-mode-label {
    margin: 0 .25rem;
    display: inline-flex;
    align-items: center;
    font-size: .75rem;
    line-height: 1;
}
.app-ai-mode-select {
    font-size: .75rem;
    line-height: 1.1;
    padding: .15rem .35rem;
    border-radius: .25rem;
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .08);
    color: inherit;
    max-width: 11rem;
}

/* ---- Finance: mobile responsive (#908) ---- */
/* Scope all rules to .finance-wrap so they only apply to the
   /administration/finance dashboard page, following the same
   pattern as the other admin module responsive blocks. */

/* Card headers with badges + buttons: allow wrapping on narrow
   screens instead of overflowing horizontally. */
.finance-wrap .finance-card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.finance-wrap .finance-card-header > div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Dense tables: enforce a sensible min-width so the table-responsive
   wrapper provides horizontal scroll instead of squishing columns
   to unreadable widths. */
.finance-wrap .finance-table {
    min-width: 500px;
}

/* Voucher transaction tables need even more room (4 data columns). */
.finance-wrap .finance-voucher-table {
    min-width: 420px;
}

/* Simulator sliders: full-width on all screen sizes so the thumb
   travels the entire card width on mobile. */
.finance-wrap .finance-sim-slider {
    width: 100%;
    display: block;
}

/* Simulator result cards: stack vertically on narrow screens. */
@media (max-width: 768px) {
    /* Card header actions wrap neatly. */
    .finance-wrap .finance-card-header {
        font-size: 0.95rem;
    }

    .finance-wrap .finance-card-header .btn {
        width: 100%;
        margin-top: 0.25rem;
    }

    .finance-wrap .finance-card-header .badge {
        font-size: 0.75rem;
    }

    /* Simulator layout: stack controls above output. */
    .finance-wrap .finance-sim-controls,
    .finance-wrap .finance-sim-output {
        max-width: 100%;
        flex: 0 0 100%;
    }

    /* Simulator result columns: stack the three summary cards. */
    .finance-wrap .finance-sim-output .col-md-4 {
        max-width: 100%;
        flex: 0 0 100%;
        margin-bottom: 0.5rem;
    }

    /* Simulator result headings: slightly smaller on mobile. */
    .finance-wrap .finance-sim-output .h4 {
        font-size: 1.1rem;
    }

    /* Tables: compact padding for better mobile readability. */
    .finance-wrap .finance-table th,
    .finance-wrap .finance-table td {
        padding: 0.35rem 0.4rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Voucher table: hide the "Text" column (4th column) on narrow
       screens to reduce horizontal overflow. The voucher text is
       already shown in the voucher header above the table. */
    .finance-wrap .finance-voucher-table th:nth-child(4),
    .finance-wrap .finance-voucher-table td:nth-child(4) {
        display: none;
    }

    /* Import history table: hide "Bokföringsår" column on narrow
       screens (5th column) to reduce width. */
    .finance-wrap .finance-table thead th:nth-child(4),
    .finance-wrap .finance-table tbody td:nth-child(4) {
        display: none;
    }

    /* Card body padding: slightly tighter on mobile. */
    .finance-wrap .card-body {
        padding: 0.75rem;
    }

    /* Hero section: smaller padding on mobile. */
    .finance-wrap .finance-hero {
        padding: 1rem;
    }

    .finance-wrap .finance-hero h1 {
        font-size: 1.25rem;
    }

    .finance-wrap .finance-hero p {
        font-size: 0.9rem;
    }

    /* Collapse form rows: stack form groups vertically. */
    .finance-wrap .form-row .form-group {
        max-width: 100%;
        flex: 0 0 100%;
    }

    /* Overview cards: stack 1-per-row on very small screens. */
    .finance-wrap .col-xl-3 {
        max-width: 100%;
        flex: 0 0 100%;
    }

    /* Liquidity card: stack the header row. */
    .finance-wrap .card-body .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .finance-wrap .card-body .d-flex.justify-content-between .text-right {
        text-align: left;
    }
}

/* Very narrow screens (≤ 576px): further compaction. */
@media (max-width: 576px) {
    .finance-wrap .finance-table {
        min-width: 320px;
    }

    .finance-wrap .finance-voucher-table {
        min-width: 280px;
    }

    /* Simulator: hide the "Status" column in the yearly projection
       table (3rd column) — the ✅/⚠️ icon is redundant with the
       alert banner above it. */
    .finance-wrap #fee-simulator .table th:nth-child(3),
    .finance-wrap #fee-simulator .table td:nth-child(3) {
        display: none;
    }

    /* Energy readings table: hide "Faktura" column (5th column). */
    .finance-wrap #energy-monitoring .finance-table thead th:nth-child(5),
    .finance-wrap #energy-monitoring .finance-table tbody td:nth-child(5) {
        display: none;
    }
}
