body, .bg-white {
    background: #222 !important;
    color: #fff;
}

.container-custom.kort-header,
.container-fluid.kort-header {
    background: #2a2a2a !important;
    border-bottom: 1px solid #555 !important;
}

.container-fluid.kort-header h1,
.container-custom.kort-header h1 {
    color: #fff !important;
}

.border-box {
    border: 1px solid #555 !important;
    background: #333 !important;
    color: #fff;
}

.border-bottom {
    border-bottom: 1px solid #777 !important;
}

.editable-v2 {
    border: 1px solid #555 !important;
    background: #555 !important;
    color: #fff;
}

h1 {
    color: #fff;
}

.table {
    color: #fff !important;
}

.table td {
    border-top: 1px solid #777 !important;
}

.table thead th {
    background: #000 !important;
    color: #fff !important;
    border-color: #555 !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #222 !important;
    color: #fff !important;
}

.table-striped tbody tr:nth-of-type(even) {
    background-color: #333 !important;
    color: #fff !important;
}

.table-striped tbody tr:nth-of-type(odd) td,
.table-striped tbody tr:nth-of-type(even) td {
    background-color: inherit !important;
    color: #fff !important;
}

.table-bordered {
    border-color: #555 !important;
}

.table-bordered th,
.table-bordered td {
    border-color: #555 !important;
}

.bg-light {
    background: #333 !important;
}

.bg-lighter {
    background: #555 !important;
}

.nordiska-kundkorg {
    background: #333;
}

.nordiska-kundkorg td span.edit {
    background: #4a4a4a !important;
    color: #fff !important;
}

.nordiska-kundkorg td span.edit:hover {
    background: #555 !important;
    color: #fff !important;
}

a {
    color: #58b8fe;
}

.table-nordiska>thead>tr,
.table-nps>thead>tr,
.table-editable>thead>tr {
    background-color: #222 !important;
    color: #fff !important;
}

.table-nordiska>tbody>tr:nth-of-type(odd),
.table-nps>tbody>tr:nth-of-type(odd),
.table-editable>tbody>tr:nth-of-type(odd) {
    background-color: #222 !important;
    color: #fff !important;
}

.table-nordiska>tbody>tr:nth-of-type(even),
.table-nps>tbody>tr:nth-of-type(even),
.table-editable>tbody>tr:nth-of-type(even) {
    background-color: #444 !important;
    color: #fff !important;
}

.table-nordiska>tbody>tr:nth-of-type(odd) td,
.table-nps>tbody>tr:nth-of-type(odd) td,
.table-editable>tbody>tr:nth-of-type(odd) td {
    background-color: inherit !important;
    color: #fff !important;
}

.table-nordiska>tbody>tr:nth-of-type(even) td,
.table-nps>tbody>tr:nth-of-type(even) td,
.table-editable>tbody>tr:nth-of-type(even) td {
    background-color: inherit !important;
    color: #fff !important;
}

/**
 * Uppgifter & Loggar
 */

.nordiska-bg-light-green { background: #5d735d; color: #fff; }
.nordiska-bg-light-yellow { background: #919151; color: #fff; }

.text-black-25 { color: #ccc !important; }
.text-dark { color: #999 !important; }

/**
 * Granskningslogg
 */

.table-granskningslogg th {
    background: #000;
}

.table-granskningslogg tbody tr:nth-of-type(odd) {
    background-color: #333 !important;
}

.table-granskningslogg tbody tr:nth-of-type(even) {
    background-color: #000 !important;
}

/**
 * Filer
 */

.tbl-filer thead tr, .tbl-telefonsamtal thead tr {
    background-color: #0f0f0f !important;
}

.tbl-filer tbody tr:nth-of-type(odd), .tbl-telefonsamtal tbody tr:nth-of-type(odd) {
    background-color: #333 !important;
}

.tbl-filer tbody tr:nth-of-type(even), .tbl-telefonsamtal tbody tr:nth-of-type(even) {
    background-color: #000 !important;
}

.btn-white {
    background-color: #333 !important;
    color: #fff !important;
}

/**
 * Forms & Inputs
 */

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea,
.form-control {
    background: #333 !important;
    color: #fff !important;
    border: 1px solid #555 !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus,
.form-control:focus {
    background: #444 !important;
    border-color: #58b8fe !important;
}

input::placeholder,
textarea::placeholder {
    color: #999 !important;
}

/**
 * Buttons
 */

.btn-light {
    background-color: #444 !important;
    border-color: #555 !important;
    color: #fff !important;
}

.btn-light:hover,
.btn-light:focus,
.btn-light:active,
.btn-light.active {
    background-color: #555 !important;
    border-color: #666 !important;
    color: #fff !important;
}

.btn-gray {
    background-color: #444 !important;
    border-color: #555 !important;
    color: #fff !important;
}

.btn-gray:hover {
    background-color: #555 !important;
}

.btn-primary:hover,
.btn-success:hover,
.btn-info:hover,
.btn-warning:hover,
.btn-danger:hover {
    filter: brightness(1.2);
}

/**
 * Modals
 */

.modal-content {
    background: #222 !important;
    color: #fff !important;
}

.modal-header,
.modal-footer {
    border-color: #555 !important;
    background: #333 !important;
}

.modal-title {
    color: #fff !important;
}

.close {
    color: #fff !important;
    opacity: .8;
}

/**
 * Dropdowns
 */

.dropdown-menu {
    background: #333 !important;
    border-color: #555 !important;
}

.dropdown-item {
    color: #fff !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: #444 !important;
    color: #fff !important;
}

.dropdown-header {
    color: #999 !important;
}

.dropdown-divider {
    border-color: #555 !important;
}

/**
 * Cards
 */

.card {
    background: #333 !important;
    border-color: #555 !important;
}

.card-header,
.card-footer {
    background: #2a2a2a !important;
    border-color: #555 !important;
    color: #fff !important;
}

.card-body {
    background: #333 !important;
    color: #fff !important;
}

/**
 * Alerts
 */

.alert {
    border-color: #555 !important;
}

.alert-info {
    background: #1a4d5c !important;
    color: #fff !important;
}

.alert-success {
    background: #1a4d2c !important;
    color: #fff !important;
}

.alert-warning {
    background: #5c4d1a !important;
    color: #fff !important;
}

.alert-danger {
    background: #5c1a1a !important;
    color: #fff !important;
}

/**
 * Badges & Labels
 */

.badge-light {
    background: #444 !important;
    color: #fff !important;
}

/**
 * Pagination
 */

.pagination .page-link {
    background: #333 !important;
    border-color: #555 !important;
    color: #58b8fe !important;
}

.pagination .page-link:hover {
    background: #444 !important;
}

.pagination .page-item.active .page-link {
    background: #58b8fe !important;
    border-color: #58b8fe !important;
}

/**
 * Breadcrumbs
 */

.breadcrumb {
    background: #333 !important;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #999 !important;
}

/**
 * Progress bars
 */

.progress {
    background: #333 !important;
}

/**
 * List groups
 */

.list-group-item {
    background: #333 !important;
    border-color: #555 !important;
    color: #fff !important;
}

.list-group-item:hover {
    background: #444 !important;
}

/**
 * Navbar dropdown fixes
 */

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,.8) !important;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #fff !important;
}

/**
 * Additional table variants
 */

.tbl-nordiska-sm {
    background: #222 !important;
    color: #fff !important;
}

.tbl-nordiska-sm thead tr {
    background: #000 !important;
}

.tbl-nordiska-sm tbody tr:nth-of-type(odd) {
    background: #222 !important;
}

.tbl-nordiska-sm tbody tr:nth-of-type(even) {
    background: #333 !important;
}

/**
 * Kundkorg (Shopping cart)
 */

.nordiska-kundkorg thead tr {
    background: #000 !important;
}

.nordiska-kundkorg th {
    color: #fff !important;
    border-color: #555 !important;
}

.nordiska-kundkorg td {
    border-color: #555 !important;
}

.nordiska-kundkorg tfoot th {
    border: 1px solid #555 !important;
}

/* Changeable product highlights - dark mode */
.nordiska-kundkorg td span.kundkorg-changeable {
    background: #4a4a4a !important;
    color: #fff !important;
}

.nordiska-kundkorg td span.kundkorg-changeable:hover {
    background: #555 !important;
    color: #fff !important;
}

/* Changeable product dropdown items - dark mode */
.nordiska-kundkorg .kundkorg-changeable-item {
    background: #4a4a4a !important;
    color: #fff !important;
}

.nordiska-kundkorg .kundkorg-changeable-item:hover {
    background: #555 !important;
    color: #fff !important;
}

/**
 * Scoreboard
 */

.scoreboard-item {
    color: #fff !important;
}

/**
 * Additional borders
 */

.border,
.border-top,
.border-bottom,
.border-left,
.border-right {
    border-color: #555 !important;
}

/**
 * Text colors
 */

.text-muted {
    color: #999 !important;
}

.text-secondary {
    color: #aaa !important;
}

/**
 * Pre element
 */

pre {
    color: #fff !important;
}

/**
 * Fix for inline styles on kort pages
 */

.foto-container img {
    border-color: #555 !important;
}

/**
 * Tooltips
 */

.tooltip-inner {
    background: #222 !important;
}

.bs-tooltip-top .arrow::before,
.bs-tooltip-auto[x-placement^="top"] .arrow::before {
    border-top-color: #222 !important;
}

.bs-tooltip-right .arrow::before,
.bs-tooltip-auto[x-placement^="right"] .arrow::before {
    border-right-color: #222 !important;
}

.bs-tooltip-bottom .arrow::before,
.bs-tooltip-auto[x-placement^="bottom"] .arrow::before {
    border-bottom-color: #222 !important;
}

.bs-tooltip-left .arrow::before,
.bs-tooltip-auto[x-placement^="left"] .arrow::before {
    border-left-color: #222 !important;
}

/**
 * Popovers
 */

.popover {
    background: #333 !important;
    border-color: #555 !important;
}

.popover-header {
    background: #222 !important;
    border-color: #555 !important;
    color: #fff !important;
}

.popover-body {
    color: #fff !important;
}

/**
 * Custom scrollbars (webkit browsers)
 */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #222;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/**
 * Chart.js Canvas Dark Mode
 * Charts need white/light text for readability on dark backgrounds
 */
canvas {
    background: transparent !important;
}

/* Chart container backgrounds */
.chart-holder,
.chart-holder > div {
    background: transparent !important;
}

/* Ensure h5 headings above charts are visible */
.chart-holder h5,
.chart-holder .badge {
    color: #fff !important;
}

.chart-holder .badge-success {
    background-color: #1a4d2c !important;
    color: #fff !important;
}

.chart-holder .badge-warning {
    background-color: #5c4d1a !important;
    color: #fff !important;
}

.chart-holder .badge-info {
    background-color: #1a4d5c !important;
    color: #fff !important;
}

/**
 * Email Interface (nordiska-epost)
 * Comprehensive dark mode for the email system
 */

/* Main email container */
.nordiska-epost {
    background: #222 !important;
    color: #fff !important;
}

/* Folder pane */
.folder-pane {
    background: #2a2a2a !important;
    color: #fff !important;
}

.folder-pane h5 {
    color: #fff !important;
}

.folder-pane .mail-folders li a {
    color: #ccc !important;
    background: transparent !important;
}

.folder-pane .mail-folders li a:hover {
    background: #444 !important;
    color: #fff !important;
}

/* Message list pane */
.message-pane {
    background: #222 !important;
}

.message-pane .messages {
    background: #222 !important;
}

/* Message items in list */
.message-item {
    background: #333 !important;
    border: 1px solid #555 !important;
    color: #fff !important;
}

.message-item .subject-holder,
.message-item .meta-holder,
.message-item .meta-holder a,
.message-item .meta-from,
.message-item .meta-created,
.message-item .meta-expires {
    color: #fff !important;
}

.message-item a {
    color: #58b8fe !important;
}

/* Reading pane */
.reading-pane {
    background: #222 !important;
}

.reading-pane .scrollable-area {
    background: #222 !important;
}

/* Message header in reading pane */
.message-header {
    background: #333 !important;
    border: 1px solid #555 !important;
    color: #fff !important;
}

.message-header span {
    color: #fff !important;
}

.message-header b {
    color: #fff !important;
}

/* Message body in reading pane */
.message-body {
    background: #2a2a2a !important;
    border: 1px solid #555 !important;
    color: #fff !important;
}

/* Force white text on all elements in message body (overrides HTML email formatting) */
.message-body,
.message-body * {
    color: #fff !important;
}

.message-body p,
.message-body div,
.message-body span,
.message-body td,
.message-body th,
.message-body li {
    color: #fff !important;
}

/* Links in message body */
.message-body a {
    color: #58b8fe !important;
}

/* Tables in message body */
.message-body table {
    border-color: #555 !important;
}

.message-body table td,
.message-body table th {
    border-color: #555 !important;
    background: transparent !important;
}

/* Message footer (attachments) */
.message-footer {
    background: #333 !important;
    border: 1px solid #555 !important;
    color: #fff !important;
}

.message-footer a {
    background: #444 !important;
    border: 1px solid #666 !important;
    color: #fff !important;
}

/* Message editor */
.message-editor {
    background: #222 !important;
}

.message-editor .bg-light {
    background: #333 !important;
    border: 1px solid #555 !important;
    color: #fff !important;
}

.message-editor input {
    background: #2a2a2a !important;
    color: #fff !important;
    border: none !important;
}

.message-editor b {
    color: #fff !important;
}

/* Quill editor */
.message-editor #editor,
.message-editor .ql-container {
    background: #2a2a2a !important;
    color: #fff !important;
}

.message-editor .ql-editor {
    background: #2a2a2a !important;
    color: #fff !important;
}

.message-editor .ql-toolbar {
    background: #333 !important;
    border: 1px solid #555 !important;
}

.message-editor .ql-stroke {
    stroke: #fff !important;
}

.message-editor .ql-fill {
    fill: #fff !important;
}

.message-editor .ql-picker-label {
    color: #fff !important;
}

/* Browser/sidebar pane */
.browser-pane {
    background: #222 !important;
    color: #fff !important;
}

.browser-pane h5 {
    color: #fff !important;
}

.browser-pane .border {
    background: #333 !important;
    border: 1px solid #555 !important;
    color: #fff !important;
}

.browser-pane .bg-white {
    background: #333 !important;
}

.browser-pane .bg-light {
    background: #2a2a2a !important;
    border: 1px solid #555 !important;
}

.browser-pane ul {
    color: #fff !important;
}

.browser-pane ul li {
    background: #333 !important;
    border: 1px solid #555 !important;
}

.browser-pane ul li a {
    color: #58b8fe !important;
}

.browser-pane .text-muted {
    color: #999 !important;
}

/* Dividers */
.frame-divider-one:hover,
.frame-divider-two:hover,
.frame-divider-three:hover {
    background-color: #666 !important;
}

/* Selected message */
.nordiska-epost .bg-selected {
    background: #4a4a00 !important;
}

/* Attachments in draft */
.draft-attached-files span {
    background: #444 !important;
    border: 1px solid #666 !important;
    color: #fff !important;
}

/* User face indicator */
.user-face span {
    background: #444 !important;
    color: #fff !important;
}

/**
 * Yellow/Light Highlight Colors
 * Replace bright yellow highlights with dark equivalents
 */

/* Main highlight class */
.bg-highlight {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Yellow background variants */
.bg-light-yellow,
.nordiska-bg-light-yellow {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Inline yellow backgrounds from custom.css */
[style*="background: #ffc"],
[style*="background:#ffc"],
[style*="background: #ffd"],
[style*="background:#ffd"],
[style*="background: #ffe"],
[style*="background:#ffe"],
[style*="background: #ffb"],
[style*="background:#ffb"],
[style*="background: #ffffcc"],
[style*="background:#ffffcc"],
[style*="background: #fffff3"],
[style*="background:#fffff3"] {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Editable fields with yellow highlight */
.editable-active,
.editable-focus,
.editable:hover {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Nordiska select option highlight */
.nordiska-select-option.bg-highlight {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Time sheet yellow highlights */
.tider-row-highlight,
.tider-cell-highlight {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Pink highlight (keep it distinct but darker) */
[style*="background: #ffbef8"],
[style*="background:#ffbef8"] {
    background: #5a2a54 !important;
    color: #fff !important;
}

/* Email interface specific yellow highlights */
.nordiska-epost .bg-selected {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Force all child elements in selected message to have white text */
.nordiska-epost .bg-selected,
.nordiska-epost .bg-selected *,
.nordiska-epost .bg-selected a,
.nordiska-epost .bg-selected .meta-from a,
.nordiska-epost .bg-selected .meta-holder,
.nordiska-epost .bg-selected .meta-holder a,
.nordiska-epost .bg-selected .subject-holder,
.nordiska-epost .bg-selected .subject-holder a {
    color: #fff !important;
}

/* Override inline color styles on selected messages */
.nordiska-epost .bg-selected [style*="color"],
.nordiska-epost .bg-selected a[style*="color"] {
    color: #fff !important;
}

/* Folder pane selected state (set by JS with inline styles) */
.folder-pane .mail-folders li a[style*="background: #ddd"],
.folder-pane .mail-folders li a[style*="background:#ddd"] {
    background: #444 !important;
    color: #fff !important;
}

/* Any element with light gray background in dark mode */
[style*="background: #ddd"],
[style*="background:#ddd"],
[style*="background: #eee"],
[style*="background:#eee"],
[style*="background: #e6e6e6"],
[style*="background:#e6e6e6"] {
    background: #444 !important;
}

/* Light backgrounds that need to be dark */
[style*="background: #f9f9f9"],
[style*="background:#f9f9f9"],
[style*="background: #f0f0f0"],
[style*="background:#f0f0f0"],
[style*="background: #f5f5f5"],
[style*="background:#f5f5f5"] {
    background: #2a2a2a !important;
}

/* Catch-all for any remaining light backgrounds */
[style*="background: #f"],
[style*="background:#f"] {
    background: #333 !important;
}

/* Sent message header background (set in JS line 1256) */
.message-header[style*="background: #c99"],
.message-header[style*="background:#c99"] {
    background: #5a2a2a !important;
    color: #fff !important;
}

/**
 * Table Row Highlighting (nordiska-tbl.js)
 * Better hover and highlight effects for dark mode
 * IMPORTANT: These override custom.css lines 1075-1089 which use #ffc yellow backgrounds
 * Using body prefix for maximum specificity
 */

/* Table row hover effect */
body .tbl-nordiska tbody tr:hover,
body .table-nordiska tbody tr:hover,
body .table-nps tbody tr:hover {
    background: #3a3a3a !important;
    color: #fff !important;
    cursor: pointer;
}

/* Links within hover rows - CRITICAL: override custom.css line 1079-1080 */
body .tbl-nordiska tbody tr:hover a,
body .table-nordiska tbody tr:hover a,
body .table-nps tbody tr:hover a {
    background: #3a3a3a !important;
    color: #fff !important;
}

/* Highlighted row (added by nordiska-tbl.js) */
body .tbl-nordiska tbody tr.highlighted,
body .tbl-nordiska tr.highlighted,
body .table-nordiska tbody tr.highlighted,
body .table-nps tbody tr.highlighted {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Links within highlighted rows - CRITICAL: override custom.css line 1087-1088 */
body .tbl-nordiska tbody tr.highlighted a,
body .tbl-nordiska tr.highlighted a,
body .table-nordiska tbody tr.highlighted a,
body .table-nps tbody tr.highlighted a {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Clickable elements in highlighted rows */
body .tbl-nordiska tbody tr.highlighted .clickable,
body .table-nordiska tbody tr.highlighted .clickable,
body .table-nps tbody tr.highlighted .clickable {
    background: #4a4a00 !important;
    color: #fff !important;
}

/**
 * Produktionsplanering Table Highlighting
 * Same overrides for .tbl-produktionsplanering tables
 * Using body prefix for maximum specificity
 */

/* Table row hover effect */
body .tbl-produktionsplanering tbody tr:hover {
    background: #3a3a3a !important;
    color: #fff !important;
    cursor: pointer;
}

/* Links within hover rows */
body .tbl-produktionsplanering tbody tr:hover a {
    background: #3a3a3a !important;
    color: #fff !important;
}

/* Highlighted row */
body .tbl-produktionsplanering tbody tr.highlighted,
body .tbl-produktionsplanering tr.highlighted {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Links within highlighted rows */
body .tbl-produktionsplanering tbody tr.highlighted a,
body .tbl-produktionsplanering tr.highlighted a {
    background: #4a4a00 !important;
    color: #fff !important;
}

/* Clickable elements in highlighted rows */
body .tbl-produktionsplanering tbody tr.highlighted .clickable,
body .tbl-produktionsplanering tr.highlighted .clickable {
    background: #4a4a00 !important;
    color: #fff !important;
}

/**
 * Nummerlistor Status Colors
 * Dark mode overrides for status row background colors
 * Using body prefix for higher specificity to override inline styles
 */

body .status-hamtad-x,
body tr.status-hamtad-x {
    background: #3d3020 !important;
    color: #ddd !important;
}

body .status-paborjad,
body tr.status-paborjad {
    background: #4a3510 !important;
    color: #ddd !important;
}

body .status-hamtad,
body tr.status-hamtad {
    background: #3a3520 !important;
    color: #ddd !important;
}

body .status-problem,
body tr.status-problem {
    background: #3d1a1a !important;
    color: #ddd !important;
}

body .status-importerad,
body tr.status-importerad {
    background: #1a3d1a !important;
    color: #ddd !important;
}

body .status-skall-hamtas,
body tr.status-skall-hamtas {
    background: #2a2a1a !important;
    color: #ddd !important;
}

/**
 * Nummerlistor Table Styling
 * Override light yellow hover and ensure proper dark backgrounds
 */

/* Override light yellow hover effect */
.table-holder table tr:hover td,
.container-custom table tr:hover td {
    background: #3a3a3a !important;
    color: #fff !important;
}

/* Ensure table has dark background */
.table-holder .table,
.table-holder table {
    background: #222 !important;
}

/* Ensure tbody and cells don't override status colors */
.table-holder .table tbody,
.table-holder table tbody {
    background: transparent !important;
}

.table-holder .table td,
.table-holder table td {
    background: transparent !important;
    color: #fff !important;
}

/**
 * Box Offert - Selected State (Uterumspaket) - Dark Mode
 */

.box-offert-selected {
    background: #2d4a2d !important;
    color: #fff !important;
}