/* ========================================
   ГЛОБАЛЬНЫЕ СТИЛИ
   ======================================== */

:root {
    --primary-color: #48A7FF;
    --primary-light: #D6EBFF;
    --bg-gray: #D8D9DB;
    --text-dark: #3E404C;
    --text-light: #9A9DB7;
    --gray-100: #f4f6f8;
    --gray-200: #e7eaee;
    --gray-300: #d3d8de;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(62, 64, 76, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg-gray);
    color: var(--text-dark);
    height: 100%;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100vh;
    overflow: hidden;
}

/* ========================================
   ОСНОВНОЙ КОНТЕНТ
   ======================================== */

.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ========================================
   ДВУХКОЛОНОЧНЫЙ ЛЕЙАУТ
   ======================================== */

.main-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
}

/* Кнопка сворачивания панели настроек */
.toggle-settings-panel {
    align-self: stretch;
    flex: 0 0 14px;
    padding: 4px !important;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(72, 167, 255, 0.35);
    font-size: 14px;
}

.toggle-settings-panel::before {
    content: "⮜";
    font-size: 14px;
    color: #ffffff;
}

.toggle-settings-panel:hover {
    background: #3897f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(72, 167, 255, 0.4);
}

.main-layout.settings-collapsed .toggle-settings-panel::before {
    content: "⮞";
}

.main-layout.settings-collapsed .toggle-settings-panel {
    transform: translateX(-4px);
}

.control-panel {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    background: #ffffff;
    padding: 16px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.main-layout.settings-collapsed .control-panel {
    display: none;
}

.dashboard-panel {
    flex: 1;
    min-width: 0;
    min-height: 0;
    background: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#my-superset-container {
    flex: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 16px;
    padding: 0;
    background: #ffffff;
    position: relative;
}

.dashboard-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: inherit;
}

#my-superset-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#my-superset-container > div {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ========================================
   ФОРМЫ
   ======================================== */

.form-group {
    margin-bottom: 8px;
}

.auth-session-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--gray-100);
}

.auth-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(72, 167, 255, 0.35);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.auth-session-check-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(72, 167, 255, 0.2);
}

.date-range-error {
    margin-top: 6px;
    font-size: 12px;
    color: #dc3545;
    font-weight: 500;
}

/* Кнопки */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(72, 167, 255, 0.35);
    padding: 8px 16px;
    font-size: 14px;
}

.btn-primary:hover {
    background: #3897f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(72, 167, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #b3b3b3 0%, #8c8c8c 100%);
    color: #e6e6e6;
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
    transform: none;
    pointer-events: none;
}

#edit-save-btn.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#edit-save-btn.loading::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ========================================
   ФУТЕР
   ======================================== */

.app-footer {
    background: white;
    padding: 12px 24px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    flex-shrink: 0;
}



/* ========================================
   КОНТЕКСТНОЕ МЕНЮ
   ======================================== */

#context-menu {
    display: none;
    position: fixed;
    z-index: 10000;
    background: white;
    border: 1px solid var(--gray-300);
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    overflow: hidden;
    min-width: 200px;
    padding: 4px 0;
}

#edit-object-item,
#edit-dashboard-item {
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--primary-color);
    font-weight: 500;
}

#edit-object-title {
    margin: 4px 0 0 0;
    font-weight: 500;
    font-size: 16px;
    color: var(--primary-color);
    word-break: break-word;
    max-width: 100%;
}

#edit-object-item:hover,
#edit-dashboard-item:hover {
    background: var(--primary-light);
}

/* ========================================
   МОДАЛЬНОЕ ОКНО
   ======================================== */

#edit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
}

#edit-modal > div {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--text-dark);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#edit-cancel-btn {
    background: #f8f9fa;
    border: 2px solid rgb(224, 224, 224);
    font-size: 14px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 207.5px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#edit-cancel-btn:hover {
    color: var(--text-dark);
    background: #f0f0f0;
    border-radius: 8px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0; /* Не сжимается при прокрутке */
    background: white;
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
}

.control-panel .form-group:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.control-panel .form-group:last-child > .object-tree-container {
    flex: 1;
    min-height: 0;
}

/* Исправление выравнивания дерева объектов */
.object-tree .folder-header,
.object-tree .leaf label {
    align-items: flex-start !important;
    display: flex !important;
    gap: 8px !important;
    padding: 4px 0 !important;
    width: 100% !important;
}

/* Убираем ненужные отступы для правильного выравнивания */
.object-tree ul {
    padding-left: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

.object-tree li {
    margin: 4px 0 !important;
    width: 100% !important;
}

/* Иконки и текст должны быть на одной линии */
.object-tree .folder-header span,
.object-tree .leaf label {
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: center !important;
    line-height: 1.4 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex: 1 1 auto !important;
}

/* Для чекбоксов */
.object-tree input[type="checkbox"] {
    flex: 0 0 auto !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Убираем ненужные отступы для дочерних элементов */
.object-tree .children {
    padding-left: 20px !important;
    margin: 0 !important;
}

.object-tree-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--gray-300);
    padding: 0;
    border-radius: 4px;
    background: var(--gray-100);
    font-size: 14px;
    margin-top: 4px;
    position: relative;
}

.object-tree {
    min-height: 0;
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.object-tree .folder-header span:first-child,
.object-tree .leaf label span:first-child {
    flex: 0 0 auto !important;
    margin-right: 4px !important;
}

.object-tree .folder-header span:last-child,
.object-tree .leaf label span:last-child {
    flex: 1 1 auto !important;
    text-align: left !important;
    padding-left: 4px !important;
}

/* ========================================
   ВКЛАДКИ МОДАЛЬНОГО ОКНА
   ======================================== */

.dashboard-tabs-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tabs-header {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--gray-300);
    padding-bottom: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.tab-button {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: var(--text-light);
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    font-size: 14px;
    border-radius: 4px 4px 0 0;
}

.tab-button:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.tab-button:active {
    background: var(--gray-200);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
}

.add-dashboard-tab {
    color: #28a745 !important;
    font-weight: 600 !important;
}

.add-dashboard-tab:hover {
    background: #e8f5e9 !important;
    color: #218838 !important;
}

.add-dashboard-tab.active {
    color: #28a745 !important;
    border-bottom: 2px solid #28a745 !important;
}

.tabs-content {
    padding: 16px 0;
    min-height: 200px;
}

.dashboard-permissions-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-permissions-status {
    font-size: 13px;
    color: var(--text-dark);
    background: #f8f9fa;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 8px 10px;
}

.dashboard-permission-search {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
}

.dashboard-permission-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(72, 167, 255, 0.2);
}

.dashboard-permissions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.dashboard-permission-sort-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dashboard-permission-sort-btn {
    font-size: 12px;
    padding: 6px 10px;
}

.dashboard-permission-sort-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.dashboard-permission-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 10px;
    background: #fff;
}

.dashboard-permission-row.present {
    background: #f4fbf6;
    border-color: #c7e9d0;
}

.dashboard-permission-row.missing {
    background: #fcfcfc;
    border-color: #e5e8ec;
}

.dashboard-permission-row.pending-add {
    border-color: #84d59a;
    background: #e9f9ee;
}

.dashboard-permission-row.pending-delete {
    border-color: #ef9a9a;
    background: #fdecec;
}

.dashboard-permission-label {
    font-size: 14px;
    color: var(--text-dark);
    word-break: break-word;
}

.dashboard-permission-meta {
    font-size: 12px;
    color: var(--text-light);
    min-width: 110px;
    text-align: right;
}

.dashboard-permission-action-btn {
    min-width: 148px;
}

.dashboard-permissions-empty {
    font-size: 13px;
    color: var(--text-light);
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
    padding: 14px;
    text-align: center;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Стили для контента вкладок */
.tab-content > div {
    padding: 16px;
    background: var(--gray-100);
    border-radius: 4px;
}

.tab-content h4 {
    margin: 0 0 12px 0;
    color: var(--text-dark);
    font-size: 16px;
}

.tab-content p {
    margin: 0;
    color: var(--text-light);
    font-size: 14px;
}

.tab-content p + p {
    margin-top: 8px;
}

/* Стили для селекта и кнопки */
#add-dashboard-select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 14px;
}

#add-dashboard-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(72, 167, 255, 0.2);
}

#add-to-dashboard-btn {
    width: 100%;
    padding: 10px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s;
}

#add-to-dashboard-btn:hover {
    background: #218838;
}

#add-to-dashboard-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

#add-dashboard-status {
    margin-top: 12px;
    padding: 8px;
    border-radius: 4px;
    display: none;
    font-size: 13px;
}

/* Стили для скролла вкладок */
.tabs-header::-webkit-scrollbar {
    height: 4px;
}

.tabs-header::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.tabs-header::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.tabs-header::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* ========================================
   АГРЕГАТОРЫ В МОДАЛЬНОМ ОКНЕ
   ======================================== */

.aggregator-group {
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 12px;
    background: var(--gray-100);
}

.group-header {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.aggregators-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aggregator-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.aggregator-item:hover {
    background: var(--primary-light);
}

.aggregator-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--text-dark);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.btn-delete-aggregator {
    padding: 4px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-delete-aggregator:hover {
    background: #c82333;
}

/* Стили для удаленных агрегаторов */
.aggregator-item.deleted .aggregator-name {
    text-decoration: line-through;
    color: #dc3545;
    text-decoration-color: #dc3545;
    text-decoration-thickness: 2px;
}

.btn-undo-delete {
    background: #28a745 !important;
}

.btn-undo-delete:hover {
    background: #218838 !important;
}

/* Анимация для индикатора загрузки */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   СОСТОЯНИЯ В МОДАЛЬНОМ ОКНЕ
   ======================================== */

.state-section {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
}

.state-group {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    background: #f8f9fa;
}

.state-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.state-item:hover {
    background: #e9ecef;
}

.state-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.btn-delete-state {
    padding: 4px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-delete-state:hover {
    background: #c82333;
}

/* Стили для удаленных состояний */
.state-item.deleted .state-name {
    text-decoration: line-through;
    color: #dc3545;
    text-decoration-color: #dc3545;
    text-decoration-thickness: 2px;
}

/* Разделители секций */
.aggregator-section,
.state-section {
    margin-bottom: 10px;
}

.empty-section {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    background: #fff;
    text-align: center;
}

.empty-section h3 {
    margin: 0 0 12px 0;
    color: #6c757d;
    font-size: 18px;
    font-weight: 600;
}

.empty-section p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

/* Стили для кнопок добавления */
.btn-add-aggregator,
.btn-add-state {
    padding: 4px 8px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-add-state {
    background: #28a745;
}

.btn-add-aggregator:hover {
    background: #0069d9;
}

.btn-add-state:hover {
    background: #218838;
}

/* Стили для нового добавленного элемента */
.new-addition {
    border-left: 3px solid #28a745 !important;
    background: #d4edda !important;
}

.new-addition.state-item {
    border-left: 3px solid #ffc107 !important;
    background: #fff3cd !important;
}

.new-addition .aggregator-name,
.new-addition .state-name {
    font-weight: 500 !important;
}

/* Стили для кнопок подтверждения и отмены добавления */
.btn-confirm-add {
    padding: 4px 8px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
    margin-right: 4px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-close:hover {
    color: #333;
    background: #f0f0f0;
}

.btn-confirm-add:hover {
    background: #218838;
}

.btn-cancel-add {
    padding: 4px 8px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-cancel-add:hover {
    background: #5a6268;
}

.btn-undo-add-aggregator,
.btn-undo-add-state {
    padding: 4px 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-undo-add-aggregator:hover,
.btn-undo-add-state:hover {
    background: #5a6268;
}

/* Контейнер для кнопки добавления */
.add-button-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-aggregator-select,
.add-state-select {
    width: 150px;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 8px;
    font-size: 12px;
}

/* Стили для новых дашбордов (до сохранения) */
.new-dashboard-tab {
    background: #d4edda !important;
    color: #155724 !important;
    font-weight: 600 !important;
    position: relative;
}

.new-dashboard-tab::after {
    content: "●";
    color: #28a745;
    font-size: 10px;
    position: absolute;
    top: 2px;
    right: 4px;
    animation: pulse 2s infinite;
}

.new-dashboard-content {
    border-left: 3px solid #28a745 !important;
    background: #f8fdf8 !important;
    padding-left: 12px !important;
}

@keyframes pulse {
    0% { opacity: 0.6; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.6; transform: scale(0.8); }
}

/* Стили для уведомления о новом дашборде */
.new-dashboard-notice {
    background: #d4edda;
    border-left: 4px solid #28a745;
    padding: 12px;
    margin: 12px 0;
    border-radius: 4px;
    font-size: 14px;
    color: #155724;
}

#object-tree li.highlighted {
    background-color: #fffacd !important;
    transition: background-color 0.3s;
    border-left: 3px solid #ffc107;
}

#search-navigation {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#reset-selections-btn {
    width: 100%;
    padding: 8px 16px;
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 8px;
    font-size: 13px;
}

/* Кнопка выхода в том же стиле, что и кнопка входа */
#dots-logout-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

#dots-logout-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653e8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(102, 126, 234, 0.4);
}

#dots-logout-btn:active {
    transform: translateY(0);
}

/* ========================================
   Дата/время в хедере
   ======================================== */
/* ========================================
   ХЕДЕР
   ======================================== */

.app-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;  /* ✅ Распределяет пространство между элементами */
    background: white;
    padding: 16px 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 100;
    flex-shrink: 0;
    gap: 16px;  /* ✅ Добавляем отступ между заголовком и датой */
}

.app-header h1 {
    font-size: 24px;
    color: #333;
    font-weight: 600;
    margin: 0;  /* ✅ Убираем отступы */
    white-space: nowrap;  /* ✅ Заголовок не переносится */
}

/* ========================================
   Дата/время в хедере
   ======================================== */
.header-datetime {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;  /* ✅ Прижимает вправо */
    flex-shrink: 0;  /* ✅ Не сжимается */
}

.timezone-select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
    min-width: 140px;
    transition: border-color 0.2s;
}

.timezone-select:hover {
    border-color: #007bff;
}

.timezone-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.datetime-display {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    font-family: 'Consolas', 'Monaco', monospace;
    min-width: 150px;
    text-align: center;
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
    }

    .app-header h1 {
        text-align: center;
        font-size: 20px;
    }

    .header-datetime {
        margin-left: 0;
        justify-content: center;
        order: -1;  /* ✅ На мобильных дата сверху */
    }

    .timezone-select {
        min-width: 120px;
        font-size: 12px;
    }

    .datetime-display {
        font-size: 12px;
        min-width: 130px;
    }
}

/* ========================================
   ВИЗУАЛ ПОД РЕФЕРЕНС (тонкая докрутка)
   ======================================== */

.main-layout {
    gap: 10px;
    padding: 10px;
}

.control-panel,
.dashboard-panel,
.modal-content,
#edit-modal > div {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(62, 64, 76, 0.08);
}

.app-header {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(62, 64, 76, 0.06);
}

.app-header h1 {
    color: var(--text-dark);
    font-size: 22px;
}

.form-group label {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-dark);
    font-weight: 600;
}

.form-group input,
.form-group select,
.timezone-select {
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    background: #fff;
    color: var(--text-dark);
    padding: 8px 10px;
    font-size: 13px;
}

.form-group input::placeholder {
    color: var(--text-light);
}

.btn-primary,
#load-dashboard-btn,
#dots-login-btn,
#dots-logout-btn {
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.35);
    padding: 8px 14px;
    font-size: 13px;
}

.btn-primary:hover,
#load-dashboard-btn:hover,
#dots-login-btn:hover,
#dots-logout-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653e8a 100%);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.toggle-settings-panel {
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.35);
}

.toggle-settings-panel:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653e8a 100%);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.object-tree-container {
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    background: #f7f9fb;
}

.object-tree .folder-header span:last-child,
.object-tree .leaf label span:last-child {
    color: var(--text-dark);
}

#object-tree li.highlighted {
    background: var(--primary-light);
    border-left: 3px solid var(--primary-color);
    box-shadow: none;
}

.tab-button {
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    color: var(--text-light);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(214, 235, 255, 0.4);
}

#dashboard-mode-indicator {
    margin-top: 6px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

#minutes-window-container {
    margin-top: 8px;
}

#minutes-window-container label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
}