/* ────────────────────────────────────────────────────────────
   Court.lv — Dark theme overlay
   Activated when <html data-theme="dark"> is set.
   Overrides court-theme.css palette: bg, cards, text, borders.
   Sidebar already dark — kept as-is.
   ──────────────────────────────────────────────────────────── */

html[data-theme="dark"] {
    --court-bg: #020617;
    --court-card: #14416B;
    --court-card-elev: #0F3357;
    --court-text: #e2e8f0;
    --court-text-muted: #94a3b8;
    --court-border: #0F3357;
    --court-border-soft: #14416B;
    --court-input-bg: #0b1220;
    /* Sidebar — slightly lighter than body for clear separation */
    --court-sidebar-bg: #0F3357;
    --court-sidebar-hover: #082544;
    color-scheme: dark;
}

/* Sidebar contrast & label readability.
   EspoCRM 9 uses .navbar.navbar-inverse for both vertical sidebar
   and horizontal top bar — distinguish by parent (#header vs not). */
html[data-theme="dark"] .navbar,
html[data-theme="dark"] .navbar.navbar-inverse,
html[data-theme="dark"] .navbar.navbar-vertical,
html[data-theme="dark"] .navbar.navbar-side {
    background: var(--court-sidebar-bg) !important;
}

html[data-theme="dark"] #header .navbar.navbar-inverse {
    border-right: 1px solid var(--court-border);
}

html[data-theme="dark"] .navbar .navbar-brand-container,
html[data-theme="dark"] .navbar .navbar-logo-container {
    background-color: var(--court-sidebar-bg) !important;
    border-bottom: 1px solid var(--court-border) !important;
    /* background-image НЕ переопределяем — он задан ниже в общем
       блоке (RST logo lock-up). Shorthand `background:` сбросил
       бы его, поэтому используем background-color. */
}

/* ── Custom RST logo for sidebar (both light & dark themes) ──
   Sidebar is dark navy in BOTH themes (court-theme.css sets
   .navbar-inverse → #0F3357). Hide companyLogoId <img>, overlay
   tinted PNG via CSS background — белые паруса + orange акцент +
   белый текст «Rīgas Šķīrējtiesa», prepared for dark backdrop.
   navbar-header default = 65px → расширяем до 96px чтобы
   полный lock-up (паруса + надпись) помещался. */
.navbar .navbar-header {
    min-height: 96px !important;
}

.navbar .navbar-logo-container,
.navbar .navbar-brand-container {
    padding: 14px 12px !important;
    height: 96px !important;
    min-height: 96px;
    box-sizing: border-box;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background-image: url("/client/custom/img/rst-logo-sidebar.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: auto 64px;
}

.navbar .navbar-brand,
.navbar .navbar-brand.nav-link {
    display: block !important;
    width: 100%;
    height: 64px;
    padding: 0 !important;
    margin: 0 !important;
}

/* Hide native companyLogoId image — replaced by background above */
.navbar .navbar-brand img.logo,
.navbar .navbar-brand .logo,
.navbar .logo {
    display: none !important;
}

/* Top navbar-right strip (search/icons container) — was light-grey by default */
html[data-theme="dark"] .navbar .navbar-right,
html[data-theme="dark"] .navbar .navbar-right-container,
html[data-theme="dark"] .navbar .nav.navbar-right,
html[data-theme="dark"] ul.nav.navbar-nav.navbar-right {
    background: var(--court-sidebar-bg) !important;
}

html[data-theme="dark"] .navbar .navbar-right > li > a,
html[data-theme="dark"] .navbar .navbar-right > li > .navbar-form,
html[data-theme="dark"] .navbar .navbar-right .btn-link {
    color: rgba(241, 245, 249, 0.85) !important;
}

html[data-theme="dark"] .navbar .navbar-right > li > a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

/* Search input inside topbar — make border visible */
html[data-theme="dark"] .navbar .global-search-input,
html[data-theme="dark"] .global-search-container input.form-control {
    background: var(--court-input-bg) !important;
    border: 1px solid var(--court-border) !important;
    color: var(--court-text) !important;
}

/* Sticky list bar (appears at top on scroll: pagination, batch actions) */
html[data-theme="dark"] .sticked-bar,
html[data-theme="dark"] .sticked-bar.list-sticky-bar,
html[data-theme="dark"] .has-sticked-bar,
html[data-theme="dark"] .list-sticky-bar {
    background: var(--court-card) !important;
    border-bottom: 1px solid var(--court-border) !important;
    color: var(--court-text) !important;
}

html[data-theme="dark"] .sticked-bar .btn,
html[data-theme="dark"] .sticked-bar .text {
    color: var(--court-text) !important;
}

/* Detail-view sticky bar (appears at top on scroll: Save / Cancel) */
html[data-theme="dark"] .detail-button-container.sticked,
html[data-theme="dark"] .detail-button-container.shadowed {
    background: var(--court-card) !important;
    border-bottom: 1px solid var(--court-border) !important;
}

html[data-theme="dark"] .navbar .nav > li > a {
    color: rgba(241, 245, 249, 0.92) !important;
}

html[data-theme="dark"] .navbar .nav > li > a .full-label,
html[data-theme="dark"] .navbar .nav > li > a .short-label {
    color: rgba(241, 245, 249, 0.92) !important;
}

html[data-theme="dark"] .navbar .nav > li.active > a,
html[data-theme="dark"] .navbar .nav > li.tab.active > a {
    background: var(--court-sidebar-hover) !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .navbar .nav > li.active > a .full-label,
html[data-theme="dark"] .navbar .nav > li.active > a .short-label,
html[data-theme="dark"] .navbar .nav > li.tab.active > a .full-label,
html[data-theme="dark"] .navbar .nav > li.tab.active > a .short-label {
    color: #ffffff !important;
    font-weight: 600 !important;
}

html[data-theme="dark"] .navbar .nav > li > a:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="dark"] .navbar .nav > li > a:hover .full-label,
html[data-theme="dark"] .navbar .nav > li > a:hover .short-label {
    color: #ffffff !important;
}

html[data-theme="dark"] .navbar .nav-divider-text,
html[data-theme="dark"] .navbar .nav-divider-text .label-text,
html[data-theme="dark"] .navbar .header-breaker {
    color: rgba(148, 163, 184, 0.95) !important;
    border-top-color: rgba(255, 255, 255, 0.08) !important;
    font-weight: 600 !important;
}

/* Body & background */
html[data-theme="dark"] body {
    background: var(--court-bg) !important;
    color: var(--court-text);
}

/* Top header bar */
html[data-theme="dark"] #header {
    background: #14416B !important;
    border-bottom: 1px solid var(--court-border) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] #header .navbar-nav > li > a,
html[data-theme="dark"] #header a {
    color: var(--court-text) !important;
}

/* Cards / panels */
html[data-theme="dark"] .panel.panel-default,
html[data-theme="dark"] .list-container,
html[data-theme="dark"] .detail-container,
html[data-theme="dark"] .dashlet,
html[data-theme="dark"] .well {
    background: var(--court-card) !important;
    border: 1px solid var(--court-border) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .panel-default > .panel-heading {
    background: transparent !important;
    border-bottom: 1px solid var(--court-border) !important;
    color: var(--court-text) !important;
}

html[data-theme="dark"] .panel-body {
    color: var(--court-text);
}

/* Generic text colors */
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .page-header h3,
html[data-theme="dark"] label,
html[data-theme="dark"] .control-label {
    color: var(--court-text) !important;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .small,
html[data-theme="dark"] small {
    color: var(--court-text-muted) !important;
}

/* Default buttons */
html[data-theme="dark"] .btn-default {
    background: var(--court-card) !important;
    border: 1px solid var(--court-border) !important;
    color: var(--court-text) !important;
}

html[data-theme="dark"] .btn-default:hover {
    background: var(--court-card-elev) !important;
    border-color: #475569 !important;
}

/* Form inputs */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background: var(--court-input-bg) !important;
    border: 1px solid var(--court-border) !important;
    color: var(--court-text) !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #64748b !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus {
    background: #0a1120 !important;
    border-color: var(--court-primary) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18) !important;
}

/* Tables */
html[data-theme="dark"] .list table.table {
    background: transparent !important;
    color: var(--court-text);
}

/* Bootstrap list-group rows (used in portal "Manas lietas" expanded list) */
html[data-theme="dark"] .list,
html[data-theme="dark"] .list-expanded,
html[data-theme="dark"] .list-group {
    background: transparent !important;
}

html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .list-group-item.list-row {
    background: transparent !important;
    border-color: var(--court-border) !important;
    color: var(--court-text) !important;
}

html[data-theme="dark"] .list-group-item:hover,
html[data-theme="dark"] .list-group-item.list-row:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

html[data-theme="dark"] .dashlet[data-id="p_lietas"] table.table > thead > tr > th {
    border-bottom-color: var(--court-border) !important;
    color: var(--court-text-muted, #9ca3af);
}
html[data-theme="dark"] .dashlet[data-id="p_lietas"] table.table > tbody > tr.list-row:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}
html[data-theme="dark"] .dashlet[data-id="p_lietas"] td[data-name="prasibasSumma"] {
    color: #fbbf24;
}

html[data-theme="dark"] .list-group-item .cell,
html[data-theme="dark"] .list-group-item .expanded-row,
html[data-theme="dark"] .list-group-item .expanded-row .cell {
    color: var(--court-text);
}

html[data-theme="dark"] .list table.table > thead > tr > th {
    background: #14416B !important;
    border-bottom: 1px solid var(--court-border) !important;
    color: var(--court-text-muted) !important;
}

html[data-theme="dark"] .list table.table > tbody > tr {
    background: transparent !important;
}

html[data-theme="dark"] .list table.table > tbody > tr:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

html[data-theme="dark"] .list table.table > tbody > tr > td {
    border-top: 1px solid var(--court-border) !important;
    color: var(--court-text);
}

/* Quick search */
html[data-theme="dark"] .quick-search input {
    background: #14416B !important;
    border: 1px solid var(--court-border) !important;
    color: var(--court-text) !important;
}

html[data-theme="dark"] .quick-search input:focus {
    background: #0a1120 !important;
}

/* Kanban */
html[data-theme="dark"] .kanban-column {
    background: #14416B !important;
}

html[data-theme="dark"] .kanban-item {
    background: var(--court-card) !important;
    border: 1px solid var(--court-border) !important;
    color: var(--court-text);
}

html[data-theme="dark"] .kanban-item:hover {
    border-color: #475569 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* Modals */
html[data-theme="dark"] .modal-dialog .modal-content {
    background: var(--court-card) !important;
    border: 1px solid var(--court-border) !important;
    color: var(--court-text);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] .modal-header {
    border-bottom: 1px solid var(--court-border) !important;
}

html[data-theme="dark"] .modal-footer {
    border-top: 1px solid var(--court-border) !important;
}

html[data-theme="dark"] .modal-backdrop {
    background: #000 !important;
}

html[data-theme="dark"] .modal-backdrop.in {
    opacity: 0.7 !important;
}

/* Tabs */
html[data-theme="dark"] .nav-tabs {
    border-bottom: 1px solid var(--court-border) !important;
}

html[data-theme="dark"] .nav-tabs > li > a {
    color: var(--court-text-muted) !important;
}

html[data-theme="dark"] .nav-tabs > li > a:hover {
    background: var(--court-card-elev) !important;
    border-color: var(--court-border) !important;
}

html[data-theme="dark"] .nav-tabs > li.active > a {
    background: var(--court-card) !important;
    border-color: var(--court-border) !important;
    border-bottom-color: var(--court-primary) !important;
    color: var(--court-primary) !important;
}

/* Dropdowns */
html[data-theme="dark"] .dropdown-menu {
    background: var(--court-card) !important;
    border: 1px solid var(--court-border) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .dropdown-menu > li > a {
    color: var(--court-text) !important;
}

html[data-theme="dark"] .dropdown-menu > li > a:hover,
html[data-theme="dark"] .dropdown-menu > li > a:focus {
    background: var(--court-card-elev) !important;
    color: #fff !important;
}

html[data-theme="dark"] .dropdown-menu .divider {
    background: var(--court-border) !important;
}

/* Stream items */
html[data-theme="dark"] .stream-record-list .stream-item {
    background: var(--court-card) !important;
    border: 1px solid var(--court-border) !important;
    color: var(--court-text);
}

/* Status timeline (custom) */
html[data-theme="dark"] .court-status-timeline__dot {
    background: #334155;
    border-color: var(--court-card);
    box-shadow: 0 0 0 1px #475569;
}

html[data-theme="dark"] .court-status-timeline__item::before {
    background: #334155;
}

/* Текущая стадия — нейтральный светлый маркер (gold убран; navy слишком тёмный на dark-карточке). */
html[data-theme="dark"] .court-status-timeline__item--current .court-status-timeline__dot {
    background: #e2e8f0;
    box-shadow: 0 0 0 2px #e2e8f0, 0 0 0 5px rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .court-status-timeline__label {
    color: var(--court-text);
}

html[data-theme="dark"] .court-status-timeline__item--current .court-status-timeline__label {
    color: #fff;
}

html[data-theme="dark"] .court-status-timeline__item--pending .court-status-timeline__label,
html[data-theme="dark"] .court-status-timeline__item--pending .court-status-timeline__date,
html[data-theme="dark"] .court-status-timeline__hint,
html[data-theme="dark"] .court-status-timeline__item--skipped .court-status-timeline__date {
    color: #64748b;
}

html[data-theme="dark"] .court-status-timeline__date {
    color: var(--court-text-muted);
}

html[data-theme="dark"] .court-status-timeline__footer {
    border-top: 1px solid var(--court-border);
}

html[data-theme="dark"] .court-status-timeline__item--skipped .court-status-timeline__dot {
    background: var(--court-card);
    border-color: #475569;
    box-shadow: 0 0 0 1px #475569;
}

html[data-theme="dark"] .court-status-timeline__item--skipped::before {
    background: repeating-linear-gradient(
        to bottom,
        #334155 0,
        #334155 3px,
        transparent 3px,
        transparent 6px
    );
}

/* Parties (panel + card) */
html[data-theme="dark"] .court-parties__role + .court-parties__role,
html[data-theme="dark"] .court-party-card + .court-party-card {
    border-top-color: var(--court-border) !important;
}

html[data-theme="dark"] .court-parties__role-label,
html[data-theme="dark"] .court-parties__regnum,
html[data-theme="dark"] .court-party-card__regnum {
    color: var(--court-text-muted);
}

html[data-theme="dark"] .court-parties__field,
html[data-theme="dark"] .court-party-card__row,
html[data-theme="dark"] .court-parties__field a,
html[data-theme="dark"] .court-party-card__row a {
    color: var(--court-text);
}

html[data-theme="dark"] .court-parties__icon,
html[data-theme="dark"] .court-party-card__icon {
    color: var(--court-text-muted);
}

html[data-theme="dark"] .court-parties__empty {
    color: #475569;
}

/* File preview */
html[data-theme="dark"] .court-file-preview__iframe,
html[data-theme="dark"] .court-file-preview__image {
    border-color: var(--court-border);
    background: #14416B;
}

html[data-theme="dark"] .court-file-preview__nopreview {
    background: #14416B;
    border-color: var(--court-border);
    color: var(--court-text-muted);
}

html[data-theme="dark"] .court-file-preview__empty {
    color: var(--court-text-muted);
}

/* Print / params dialog */
html[data-theme="dark"] .court-print-dialog__group-title,
html[data-theme="dark"] .court-params-dialog__hint {
    border-bottom-color: var(--court-border);
    color: var(--court-text);
}

html[data-theme="dark"] .court-print-dialog__table tr + tr td {
    border-top-color: var(--court-border);
}

html[data-theme="dark"] .court-params-dialog .small {
    color: var(--court-text-muted);
}

/* Wizard */
html[data-theme="dark"] .court-wizard__steps {
    border-bottom-color: var(--court-border);
}

html[data-theme="dark"] .court-wizard__step {
    color: var(--court-text-muted);
}

html[data-theme="dark"] .court-wizard__hint {
    background: #14416B;
    color: var(--court-text);
}

html[data-theme="dark"] .court-wizard__file-item {
    background: #14416B;
    color: var(--court-text);
}

html[data-theme="dark"] .court-wizard__file-item i {
    color: var(--court-text-muted);
}

/* Iesniegt-lietu dashlet */
html[data-theme="dark"] .court-iesniegt-dashlet__hint {
    color: var(--court-text-muted);
}

/* HRs / dividers */
html[data-theme="dark"] hr,
html[data-theme="dark"] .panel-heading,
html[data-theme="dark"] .nav-tabs,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
    border-color: var(--court-border) !important;
}

/* Stripe / striped tables */
html[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Tooltips / popovers */
html[data-theme="dark"] .tooltip-inner {
    background: #14416B;
    color: var(--court-text);
    border: 1px solid var(--court-border);
}

html[data-theme="dark"] .popover {
    background: var(--court-card);
    border: 1px solid var(--court-border);
    color: var(--court-text);
}

html[data-theme="dark"] .popover-title {
    background: #14416B;
    border-bottom-color: var(--court-border);
    color: var(--court-text);
}

/* Code / pre */
html[data-theme="dark"] code,
html[data-theme="dark"] pre {
    background: #0b1220 !important;
    color: #f8fafc !important;
    border: 1px solid var(--court-border);
}

/* FullCalendar — dashlet "Календарь" */
html[data-theme="dark"] .fc,
html[data-theme="dark"] .fc .fc-view-harness,
html[data-theme="dark"] .fc .fc-scrollgrid,
html[data-theme="dark"] .fc table,
html[data-theme="dark"] .fc .fc-scroller {
    background: var(--court-card) !important;
    color: var(--court-text) !important;
}

html[data-theme="dark"] .fc-theme-standard td,
html[data-theme="dark"] .fc-theme-standard th,
html[data-theme="dark"] .fc-theme-standard .fc-scrollgrid {
    border-color: var(--court-border) !important;
}

html[data-theme="dark"] .fc .fc-daygrid-day,
html[data-theme="dark"] .fc .fc-col-header-cell {
    background: var(--court-card) !important;
}

html[data-theme="dark"] .fc .fc-daygrid-day-number,
html[data-theme="dark"] .fc .fc-col-header-cell-cushion {
    color: var(--court-text) !important;
}

html[data-theme="dark"] .fc .fc-day-other .fc-daygrid-day-number {
    color: var(--court-text-muted) !important;
    opacity: 0.5;
}

html[data-theme="dark"] .fc .fc-day-today {
    background: rgba(245, 158, 11, 0.12) !important;
}

html[data-theme="dark"] .fc .fc-button-primary {
    background: var(--court-card-elev) !important;
    border-color: var(--court-border) !important;
    color: var(--court-text) !important;
}

html[data-theme="dark"] .fc .fc-button-primary:hover {
    background: #334155 !important;
}

html[data-theme="dark"] .fc-toolbar-title,
html[data-theme="dark"] .fc-list-day-cushion {
    color: var(--court-text) !important;
}

html[data-theme="dark"] .fc-list-day-cushion {
    background: var(--court-card-elev) !important;
}

/* Calendar dashlet (Espo's own calendar widget if used) */
html[data-theme="dark"] .calendar-table,
html[data-theme="dark"] .calendar-month .day,
html[data-theme="dark"] .calendar-grid td {
    background: var(--court-card) !important;
    border-color: var(--court-border) !important;
    color: var(--court-text);
}

html[data-theme="dark"] .calendar-grid td.today {
    background: rgba(245, 158, 11, 0.12) !important;
}

html[data-theme="dark"] .calendar-grid td.weekend {
    background: var(--court-card-elev) !important;
}

html[data-theme="dark"] .calendar-grid th {
    background: var(--court-card-elev) !important;
    color: var(--court-text-muted) !important;
    border-color: var(--court-border) !important;
}

/* Notification badges visibility on dark header */
html[data-theme="dark"] .notification-badge {
    border: 2px solid var(--court-card) !important;
}

/* Header notification panel content */
html[data-theme="dark"] #header .navbar-nav > li > a,
html[data-theme="dark"] #header .navbar-nav > li > .dropdown-toggle {
    color: var(--court-text) !important;
}

html[data-theme="dark"] #header .navbar-nav > li > a:hover {
    background: var(--court-card-elev) !important;
}

/* Top toolbar action buttons */
html[data-theme="dark"] .button-container .btn,
html[data-theme="dark"] .detail-button-container .btn {
    background: var(--court-card-elev);
    border-color: var(--court-border);
    color: var(--court-text);
}

/* Footer */
html[data-theme="dark"] #footer,
html[data-theme="dark"] footer {
    background: transparent;
    color: var(--court-text-muted);
}

html[data-theme="dark"] #footer a,
html[data-theme="dark"] footer a {
    color: var(--court-text-muted);
}

/* Toggle button (rendered by court-theme-toggle.js) */
.court-theme-toggle {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    padding: 8px 10px;
    margin: 0 4px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1;
    opacity: 0.9;
    transition: opacity 150ms ease, background 150ms ease, color 150ms ease;
}

.court-theme-toggle:hover {
    opacity: 1;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .court-theme-toggle {
    color: var(--court-text);
}

/* Lang switcher (rendered by court-lang-switcher.js) */
.court-lang-switcher {
    position: relative;
    display: inline-block;
}
.court-lang-btn {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    padding: 8px 10px;
    margin: 0 4px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1;
    opacity: 0.9;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: opacity 150ms ease, background 150ms ease, color 150ms ease;
}
.court-lang-btn:hover {
    opacity: 1;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
}
.court-lang-btn .court-lang-code {
    font-weight: 600;
    letter-spacing: 0.02em;
}
.court-lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(15, 51, 87, 0.12);
    padding: 6px 0;
    margin: 6px 0 0;
    list-style: none;
    z-index: 9999;
}
.court-lang-menu.is-open { display: block; }
.court-lang-menu li { padding: 0; margin: 0; }
.court-lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: inherit;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
}
.court-lang-item strong {
    display: inline-block;
    min-width: 22px;
    font-weight: 600;
    color: var(--court-accent, #B45309);
}
.court-lang-item:hover {
    background: rgba(180, 83, 9, 0.10);
    text-decoration: none;
}
.court-lang-item.is-active {
    background: rgba(180, 83, 9, 0.06);
    font-weight: 500;
}

html[data-theme="dark"] .court-lang-btn { color: var(--court-text); }
html[data-theme="dark"] .court-lang-menu {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .court-lang-item { color: #e5e7eb; }
html[data-theme="dark"] .court-lang-item:hover { background: rgba(180, 83, 9, 0.22); }
html[data-theme="dark"] .court-lang-item.is-active { background: rgba(180, 83, 9, 0.14); }

/* Pre-paint flicker guard: if toggle script set theme before CSS load,
   no FOUC because variables resolve immediately. */

/* ════════════════════════════════════════════════════════════
   COURT.LV DARK — UI POLISH PASS (2026-05-12)
   Dark-mode overrides для 5 блоков
   ════════════════════════════════════════════════════════════ */

/* ──────────────── 1. Soft pills — больше насыщенности на dark card ──────────────── */
html[data-theme="dark"] .label.label-state,
html[data-theme="dark"] .label.label-status {
    background: rgba(96, 165, 250, 0.16) !important;
    color: #93c5fd !important;
    border-color: rgba(96, 165, 250, 0.28) !important;
}
html[data-theme="dark"] .label.label-state.label-default,
html[data-theme="dark"] .label.label-status.label-default {
    background: rgba(148, 163, 184, .14) !important;
    color: #cbd5e1 !important;
    border-color: rgba(148, 163, 184, .28) !important;
}
html[data-theme="dark"] .label.label-state.label-info,
html[data-theme="dark"] .label.label-status.label-info {
    background: rgba(96, 165, 250, .16) !important;
    color: #93c5fd !important;
    border-color: rgba(96, 165, 250, .30) !important;
}
html[data-theme="dark"] .label.label-state.label-warning,
html[data-theme="dark"] .label.label-status.label-warning {
    background: rgba(251, 191, 36, .14) !important;
    color: #fbbf24 !important;
    border-color: rgba(251, 191, 36, .32) !important;
}
html[data-theme="dark"] .label.label-state.label-primary,
html[data-theme="dark"] .label.label-status.label-primary {
    background: rgba(96, 165, 250, .14) !important;
    color: #93c5fd !important;
    border-color: rgba(96, 165, 250, .28) !important;
}
html[data-theme="dark"] .label.label-state.label-success,
html[data-theme="dark"] .label.label-status.label-success {
    background: rgba(52, 211, 153, .14) !important;
    color: #6ee7b7 !important;
    border-color: rgba(52, 211, 153, .30) !important;
}
html[data-theme="dark"] .label.label-state.label-danger,
html[data-theme="dark"] .label.label-status.label-danger {
    background: rgba(248, 113, 113, .14) !important;
    color: #fca5a5 !important;
    border-color: rgba(248, 113, 113, .30) !important;
}

/* ──────────────── 2. List sticky header dark ──────────────── */
html[data-theme="dark"] .list table.table > thead > tr > th {
    background: var(--court-card) !important;
    box-shadow: inset 0 -1px 0 var(--court-border);
}

html[data-theme="dark"] .list table.table > tbody > tr.checked,
html[data-theme="dark"] .list table.table > tbody > tr.selected,
html[data-theme="dark"] .list table.table > tbody > tr.list-row-checked,
html[data-theme="dark"] .list table.table > tbody > tr.row-checked {
    background: rgba(96, 165, 250, 0.08) !important;
    box-shadow: inset 3px 0 0 #60a5fa;
}

html[data-theme="dark"] .list.list-striped table.table > tbody > tr:nth-child(2n) {
    background: rgba(255, 255, 255, 0.02);
}

/* ──────────────── 3. Sticky save bar dark + heading gradient ──────────────── */
html[data-theme="dark"] .panel-default > .panel-heading {
    background: linear-gradient(to bottom, var(--court-card), rgba(15, 51, 87, 0.6)) !important;
}

html[data-theme="dark"] .detail-container > .button-container,
html[data-theme="dark"] .edit-container > .button-container,
html[data-theme="dark"] .detail > .button-container,
html[data-theme="dark"] .edit > .button-container {
    background: rgba(2, 6, 23, 0.85);
    border-bottom-color: var(--court-border);
}

html[data-theme="dark"] .panel-default > .panel-heading > .panel-title {
    color: #e2e8f0 !important;
}

/* ──────────────── 4. Empty + skeleton dark ──────────────── */
html[data-theme="dark"] .list .empty-list-message::before,
html[data-theme="dark"] .list-container .empty-list-message::before {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.10);
    background-image: linear-gradient(135deg, transparent 45%, rgba(255,255,255,0.10) 45%, rgba(255,255,255,0.10) 55%, transparent 55%);
}

html[data-theme="dark"] .ct-skel {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
    background-size: 200% 100%;
}

/* ──────────────── 5. Sidebar gold accent (без изменений — sidebar уже dark) ──────────────── */
/* Inherits gold accent from light theme rules. */

/* ──────────────── 6. Dokuments — категории (dark) ──────────────── */
html[data-theme="dark"] .dok-kat {
    background: rgba(148, 163, 184, 0.10);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.20);
}
html[data-theme="dark"] .dok-kat[data-k="Prasības pieteikums"],
html[data-theme="dark"] .dok-kat[data-k="Pretprasība"],
html[data-theme="dark"] .dok-kat[data-k="Atsauksme uz prasības pieteikumu"],
html[data-theme="dark"] .dok-kat[data-k="Atbildētāja paskaidrojumi"] {
    background: rgba(96, 165, 250, 0.14);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.28);
}
html[data-theme="dark"] .dok-kat[data-k="Parāda aprēķins"],
html[data-theme="dark"] .dok-kat[data-k="Rēķini un pavadzīmes"],
html[data-theme="dark"] .dok-kat[data-k="Avansa rēķins"],
html[data-theme="dark"] .dok-kat[data-k="Noslēguma rēķins"] {
    background: rgba(251, 191, 36, 0.14);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.28);
}
html[data-theme="dark"] .dok-kat[data-k="Līgums"],
html[data-theme="dark"] .dok-kat[data-k="Vienošanās"] {
    background: rgba(52, 211, 153, 0.14);
    color: #6ee7b7;
    border-color: rgba(52, 211, 153, 0.28);
}
html[data-theme="dark"] .dok-kat[data-k="Atgādinājums par saistību izpildi"] {
    background: rgba(251, 146, 60, 0.14);
    color: #fdba74;
    border-color: rgba(251, 146, 60, 0.28);
}
html[data-theme="dark"] .dok-kat[data-k="Brīdinājums par parāda un maksājuma saistību izpildi"] {
    background: rgba(249, 115, 22, 0.16);
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.30);
}
html[data-theme="dark"] .dok-kat[data-k="Pirmstiesas brīdinājums"] {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.30);
}
html[data-theme="dark"] .dok-kat[data-k="Izziņa"],
html[data-theme="dark"] .dok-kat[data-k="Pilnvara"] {
    background: rgba(167, 139, 250, 0.14);
    color: #c4b5fd;
    border-color: rgba(167, 139, 250, 0.28);
}
html[data-theme="dark"] .dok-kat[data-k="Iesniegums"],
html[data-theme="dark"] .dok-kat[data-k="Lūgums"],
html[data-theme="dark"] .dok-kat[data-k="Paziņojums"] {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.26);
}
html[data-theme="dark"] .dok-kat[data-k="Tiesneša lēmums"],
html[data-theme="dark"] .dok-kat[data-k="Pavēste"],
html[data-theme="dark"] .dok-kat[data-k="Protokols"] {
    background: rgba(203, 213, 225, 0.10);
    color: #e2e8f0;
    border-color: rgba(203, 213, 225, 0.22);
}

/* Portal wizard rows in dark */
html[data-theme="dark"] .court-wizard__file-row {
    background: #1e293b;
    border-color: #334155;
}
html[data-theme="dark"] .court-wizard__file-row:hover {
    border-color: #475569;
}
html[data-theme="dark"] .court-wizard__file-row.is-missing-kat {
    border-color: #b91c1c;
    background: rgba(127, 29, 29, 0.20);
}
html[data-theme="dark"] .court-wizard__file-row .court-wizard__file-name {
    color: #e2e8f0;
}
html[data-theme="dark"] .court-wizard__file-row .court-wizard__file-name i,
html[data-theme="dark"] .court-wizard__file-row .court-wizard__file-size {
    color: #94a3b8;
}
html[data-theme="dark"] .court-wizard__file-row .court-wizard__file-kat > label {
    color: #94a3b8;
}
html[data-theme="dark"] .court-wizard__file-row .court-wizard__file-kat > select {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

/* Бейдж номера дела в карточке/списке Dokuments (dark) */
a.dok-lieta-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    background: rgba(217, 119, 6, 0.16);
    color: #f0a64e !important;
    border: 1px solid rgba(217, 119, 6, 0.38);
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    text-decoration: none !important;
    transition: background .15s ease, border-color .15s ease;
}
a.dok-lieta-badge:hover {
    background: rgba(217, 119, 6, 0.26);
    border-color: rgba(217, 119, 6, 0.55);
    color: #ffbf73 !important;
}
.dok-lieta-badge__icon { font-size: 12px; opacity: .85; }
.list a.dok-lieta-badge { font-size: 13px; padding: 2px 9px; }

/* ── Atsauksme panel + modal (PUP-46) ─────────────────────────────── */
.court-atsauksme-panel__countdown { text-align: center; margin-bottom: 10px; }
.court-atsauksme-panel__days {
    display: inline-block; font-size: 30px; font-weight: 700; line-height: 1;
    margin-right: 6px; vertical-align: middle;
}
.court-atsauksme-panel__days--ok { color: #4ade80; }
.court-atsauksme-panel__days--warn { color: #fbbf24; }
.court-atsauksme-panel__days--danger { color: #f87171; }
.court-atsauksme-panel__days-label { color: #94a3b8; font-size: 13px; vertical-align: middle; }
.court-atsauksme-panel__btn { margin-top: 4px; }
.court-atsauksme-panel__done { color: #4ade80; font-weight: 600; text-align: center; padding: 6px 0; }
.court-atsauksme-panel__expired { color: #f87171; font-weight: 600; text-align: center; padding: 6px 0; }
.court-atsauksme-modal__hint { margin-bottom: 12px; }
.court-atsauksme-modal__files { margin-top: 6px; word-break: break-word; }
