/* -------------------------------
 *  Only for light theme
 * ---------------------------------*/
:root {
    /* Header */
    --header-bg: rgb(17 24 39);       /* base-900 */
    --header-border: rgb(31 41 55);   /* base-800 */
    --header-text: rgb(229 231 235);  /* light text */

    /* UL / History */
    --ul-bg: rgb(17 24 39);
    --ul-text: rgb(229 231 235);
    --ul-border: #364153;

    /* Left navbar */
    --sidebar-bg: rgb(17 24 39);
    --sidebar-border: rgb(31 41 55);
    --sidebar-text: rgb(229 231 235);

    /* Hover */
    --hover-text: rgb(255 255 255);

    --lwr-primary-color: #0f719a;
}

@media(max-width: 768px) {
    .add-related,
    .change-related, 
    .delete-related {
        display: none !important; 
    }
}

/* -------------------------------
 *   Light theme styles
 * ---------------------------------*/

/* Header */
html .bg-white.border-b {
    background-color: var(--header-bg);
    border-color: var(--header-border);
    color: var(--header-text);
}

html .bg-white.border-b a {
    color: var(--header-text);
}

html .bg-white.border-b span {
    color: var(--header-text);
}

html .bg-white.border-b a:hover {
    color: var(--hover-text);
}

/* UL / History */
html ul.bg-white.container {
    background-color: var(--ul-bg);
    color: var(--ul-text);
}

html ul.bg-white.container > li {
    border-color: var(--ul-border);
}

html ul.bg-white.container li a {
    color: var(--ul-text);
}

html ul.bg-white.container li a:hover {
    color: var(--hover-text);
}

/* Mobile / tablet object tools trigger */
html .bg-white.border-b [x-data*="showActions"] > a {
    background-color: var(--header-bg);
    border-color: var(--ul-border);
    color: var(--header-text);
}

html .bg-white.border-b [x-data*="showActions"] > a:hover {
    background-color: var(--header-border);
    color: var(--hover-text);
}

/* Left navbar */
html .border-b.border-base-200.h-\[65px\] {
    background-color: var(--sidebar-bg);
    border-color: var(--sidebar-border);
    color: var(--sidebar-text);
}

html .border-b.border-base-200.h-\[65px\] a {
    color: var(--sidebar-text);
}

html .border-b.border-base-200.h-\[65px\] a:hover {
    color: var(--hover-text);
}

#main > div:first-child {
    /* не знаю почему шапка перестала прилипать к верху КОСТЫЛЬ */
    position: sticky !important;
    top: 0 !important;
}

#result_list th::before {
    display: none; /* В таблице скраывать чтобы не было отступа когда убрал заголовок на мобилке */
}

#result_list tbody tr th a {
    font-weight: bold;
    color: var(--lwr-primary-color);
}


.lwr-primary-color {
    color: var(--lwr-primary-color) !important;
}

.status-badge {
    background-color: var(--status-badge-bg);
    border-radius: 0.375rem;
    color: var(--status-badge-text);
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    height: 1.5rem;
    line-height: 1.5rem;
    padding: 0 0.5rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge--potential {
    --status-badge-bg: #dbeafe;
    --status-badge-text: #1d4ed8;
}

.status-badge--proposal-preparation {
    --status-badge-bg: #fef3c7;
    --status-badge-text: #b45309;
}

.status-badge--proposal-sent {
    --status-badge-bg: #cffafe;
    --status-badge-text: #0e7490;
}

.status-badge--awaiting-client-response {
    --status-badge-bg: #e2e8f0;
    --status-badge-text: #475569;
}

.status-badge--negotiation {
    --status-badge-bg: #f3e8ff;
    --status-badge-text: #7e22ce;
}

.status-badge--approved {
    --status-badge-bg: #d1fae5;
    --status-badge-text: #047857;
}

.status-badge--planned {
    --status-badge-bg: #e0e7ff;
    --status-badge-text: #4338ca;
}

.status-badge--in-progress {
    --status-badge-bg: #dcfce7;
    --status-badge-text: #15803d;
}

.status-badge--completed {
    --status-badge-bg: #ccfbf1;
    --status-badge-text: #0f766e;
}

.status-badge--on-hold {
    --status-badge-bg: #ffedd5;
    --status-badge-text: #c2410c;
}

.status-badge--cancelled {
    --status-badge-bg: #ffe4e6;
    --status-badge-text: #be123c;
}

.status-badge--lost {
    --status-badge-bg: #fee2e2;
    --status-badge-text: #b91c1c;
}

.status-badge--pending {
    --status-badge-bg: #f4f4f5;
    --status-badge-text: #52525b;
}

.dark .status-badge--potential {
    --status-badge-bg: #1e3a5f;
    --status-badge-text: #93c5fd;
}

.dark .status-badge--proposal-preparation {
    --status-badge-bg: #451a03;
    --status-badge-text: #fcd34d;
}

.dark .status-badge--proposal-sent {
    --status-badge-bg: #164e63;
    --status-badge-text: #67e8f9;
}

.dark .status-badge--awaiting-client-response {
    --status-badge-bg: #334155;
    --status-badge-text: #cbd5e1;
}

.dark .status-badge--negotiation {
    --status-badge-bg: #3b0764;
    --status-badge-text: #d8b4fe;
}

.dark .status-badge--approved {
    --status-badge-bg: #064e3b;
    --status-badge-text: #6ee7b7;
}

.dark .status-badge--planned {
    --status-badge-bg: #312e81;
    --status-badge-text: #a5b4fc;
}

.dark .status-badge--in-progress {
    --status-badge-bg: #14532d;
    --status-badge-text: #86efac;
}

.dark .status-badge--completed {
    --status-badge-bg: #134e4a;
    --status-badge-text: #5eead4;
}

.dark .status-badge--on-hold {
    --status-badge-bg: #431407;
    --status-badge-text: #fdba74;
}

.dark .status-badge--cancelled {
    --status-badge-bg: #4c0519;
    --status-badge-text: #fda4af;
}

.dark .status-badge--lost {
    --status-badge-bg: #450a0a;
    --status-badge-text: #fca5a5;
}

.dark .status-badge--pending {
    --status-badge-bg: #27272a;
    --status-badge-text: #d4d4d8;
}


/* Чтобы контейнер не растягивался при использовании select2 */
.flex:has(.select2-container) > *,
.grid:has(.select2-container) > * {
    min-width: 0 !important;
}

.result-list tbody:nth-of-type(even) {
    background-color: #f3f4f6;
}

.dark .result-list tbody:nth-of-type(even) {
    background-color: #141c2c;
}

/* Keep changelists tabular on tablets; Unfold switches at 1024px by default. */
@media (min-width: 640px) and (max-width: 1023px) {
    #result_list {
        display: table;
    }

    #result_list thead th,
    #result_list tbody th,
    #result_list tbody td {
        display: table-cell;
        font-size: 0.8125rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        white-space: normal;
    }

    #result_list thead th,
    #result_list .status-badge {
        white-space: nowrap;
    }

    #result_list thead .action-checkbox-column,
    #result_list tbody .action-checkbox {
        width: 2.5rem;
    }

    #result_list thead .action-checkbox-column .lg\:hidden {
        display: none;
    }

    #result_list tbody {
        display: table-row-group;
    }

    #result_list tbody tr {
        border: 0;
        display: table-row;
        margin-bottom: 0;
    }

    #result_list tbody th::before,
    #result_list tbody td::before {
        display: none;
    }

    .model-project #result_list {
        table-layout: fixed;
    }

    .model-project #result_list .column-manager_info,
    .model-project #result_list .field-manager_info {
        width: 7rem;
    }

    .model-project #result_list .column-status_badge,
    .model-project #result_list .field-status_badge {
        width: 11rem;
    }
}

.lwr-dashboard-grid,
.lwr-dashboard-card {
    min-width: 0;
    max-width: 100%;
}

.lwr-dashboard-chart {
    display: block;
    max-width: 100% !important;
}

.lwr-reminder-menu {
    bottom: calc(100% + 8px);
    top: auto;
}

.lwr-reminder-card-active {
    border-color: rgb(147 197 253);
}

.lwr-reminder-card-overdue {
    border-color: rgb(252 165 165);
}

.dark .lwr-reminder-card-active {
    border-color: rgb(59 130 246 / 0.45);
}

.dark .lwr-reminder-card-overdue {
    border-color: rgb(239 68 68 / 0.55);
}

.lwr-reminder-badge {
    border-radius: var(--border-radius, 0.25rem);
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    height: 1.5rem;
    line-height: 1.5rem;
    margin-right: auto;
    padding-inline: 0.5rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.lwr-reminder-badge-base {
    background: rgb(243 244 246);
    color: rgb(75 85 99);
}

.lwr-reminder-badge-blue {
    background: rgb(219 234 254);
    color: rgb(29 78 216);
}

.dark .lwr-reminder-badge-base {
    background: rgb(107 114 128 / 0.2);
    color: rgb(156 163 175);
}

.dark .lwr-reminder-badge-blue {
    background: rgb(59 130 246 / 0.2);
    color: rgb(96 165 250);
}

@media (max-width: 1023px), (orientation: portrait) and (max-width: 1180px) {
    .lwr-dashboard-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100% !important;
    }

    .lwr-dashboard-card {
        width: 100% !important;
        grid-column: auto / span 1 !important;
    }
}

/* Shared admin dialog */
.admin-visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.admin-dialog {
    background: rgb(255 255 255);
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 24px 64px rgb(15 23 42 / 0.28);
    box-sizing: border-box;
    color: rgb(17 24 39);
    inset: 0;
    margin: auto;
    max-height: calc(100dvh - 2rem);
    max-width: 32rem;
    overflow: hidden;
    padding: 0;
    position: fixed;
    width: calc(100% - 2rem);
}

.dark .admin-dialog {
    background: rgb(17 24 39);
    color: rgb(243 244 246);
}

.admin-dialog::backdrop {
    background: rgb(15 23 42 / 0.55);
    backdrop-filter: blur(2px);
}

.admin-dialog__form {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 2rem);
}

.admin-dialog__header,
.admin-dialog__footer {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    padding: 1rem 1.25rem;
}

.admin-dialog__header {
    border-bottom: 1px solid rgb(229 231 235);
    gap: 1rem;
    justify-content: space-between;
}

.dark .admin-dialog__header {
    border-color: rgb(55 65 81);
}

.admin-dialog__title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5rem;
}

.admin-dialog__close {
    align-items: center;
    border-radius: 0.375rem;
    color: rgb(107 114 128);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 2.25rem;
    height: 2.25rem;
    justify-content: center;
}

.admin-dialog__close:hover {
    background: rgb(243 244 246);
    color: rgb(17 24 39);
}

.dark .admin-dialog__close:hover {
    background: rgb(31 41 55);
    color: rgb(243 244 246);
}

.admin-dialog__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding: 1.25rem;
}

.admin-dialog__footer {
    background: rgb(249 250 251);
    border-top: 1px solid rgb(229 231 235);
    gap: 0.5rem;
    justify-content: flex-end;
}

.dark .admin-dialog__footer {
    background: rgb(15 23 42);
    border-color: rgb(55 65 81);
}

@media (max-width: 720px) {
    .admin-dialog,
    .admin-dialog__form {
        max-height: calc(100dvh - 1rem);
    }

    .admin-dialog {
        width: calc(100% - 1rem);
    }

    .admin-dialog__header,
    .admin-dialog__body,
    .admin-dialog__footer {
        padding: 1rem;
    }
}
