:root {
    --widget-bg-alpha: 1;
}

body {
    background-color: #f4f6f9;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    position: relative;
}

/* Слой затемнения фона для читаемости */
#bgDimOverlay {
    position: fixed;
    inset: 0;
    background-color: #000000;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.2s ease;
}

/* Холст для анимированного оформления */
#bgAnimCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    display: none;
}

.main-workspace {
    position: relative;
    z-index: 1;
}

/* Контейнер ширины страницы */
.board-container {
    width: 100%;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}
.board-container.width-classic {
    max-width: 1320px;
}
.board-container.width-full {
    max-width: 100%;
}

/* Холст, на котором лежит сетка */
.board-stage {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 14px;
    border: 1px solid #dee2e6;
    padding: 15px;
    min-height: 560px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    transition: background 0.3s, border-color 0.3s;
}

body.has-custom-bg .board-stage {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: none;
}

/* Четкие линии сетки */
.show-grid {
    background-image: 
        linear-gradient(to right, rgba(108, 117, 125, 0.28) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(108, 117, 125, 0.28) 1px, transparent 1px);
    background-size: calc(100% / 12) 80px;
    border-right: 1px solid rgba(108, 117, 125, 0.28);
    border-bottom: 1px solid rgba(108, 117, 125, 0.28);
}
.show-grid .grid-stack-item-content {
    border: 1px dashed #6c757d;
}

/* Внешний вид виджета (с поддержкой прозрачности --widget-bg-alpha) */
.grid-stack-item-content {
    background-color: rgba(255, 255, 255, var(--widget-bg-alpha));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #212529;
    border-radius: 12px;
    border: 1px solid rgba(222, 226, 230, 0.85);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px;
    position: relative;
    overflow: hidden;
    container-type: size;
    transition: background-color 0.2s, box-shadow 0.2s;

    cursor: move;
    user-select: none;
    -webkit-user-select: none;
}
.grid-stack-item-content:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.14);
}

/* Чёткий контрастный уголок для изменения размера виджета */
.grid-stack-item > .ui-resizable-se {
    width: 18px !important;
    height: 18px !important;
    right: 4px !important;
    bottom: 4px !important;
    cursor: nwse-resize !important;
    opacity: 0.75;
    filter: contrast(200%);
}
.grid-stack-item:hover > .ui-resizable-se {
    opacity: 1;
}

/* Подсветка блока, когда таймер закончился */
.grid-stack-item-content.timer-finished {
    background-color: #fff5f5 !important;
    border-color: #dc3545 !important;
}

/* Панель кнопок управления в правом верхнем углу виджета */
.widget-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 25;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.grid-stack-item-content:hover .widget-actions {
    opacity: 1;
}
.btn-widget-action {
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: background 0.2s, color 0.2s;
}
.btn-refresh-widget {
    background: #e8f5ef;
    color: #198754;
    font-weight: 700;
}
.btn-refresh-widget:hover {
    background: #198754;
    color: #fff;
}
.btn-edit-widget {
    background: #e7f1ff;
    color: #0d6efd;
}
.btn-edit-widget:hover {
    background: #0d6efd;
    color: #fff;
}
.btn-remove-widget {
    background: #fde8ea;
    color: #dc3545;
    font-size: 15px;
}
.btn-remove-widget:hover {
    background: #dc3545;
    color: #fff;
}

/* --- ПАНЕЛЬ УПРАВЛЕНИЯ СТРАНИЦАМИ (ДАШБОРДАМИ) --- */
.dashboard-switcher-select {
    max-width: 240px;
    font-weight: 600;
    border-color: #ced4da;
    cursor: pointer;
}
.page-row-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    background: #ffffff;
    transition: border-color 0.15s, background-color 0.15s;
}
.page-row-card.is-current {
    border-color: #1b7a5e;
    background-color: #f0fdf9;
}
.page-default-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
    white-space: nowrap;
}
.page-hidden-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    white-space: nowrap;
}

/* --- ПРОПОРЦИОНАЛЬНЫЕ СТИЛИ ВИДЖЕТОВ --- */

/* 1. Часы */
.widget-clock-time {
    font-size: clamp(1.2rem, 26cqmin, 6rem);
    font-weight: 700;
    color: #0d6efd;
    line-height: 1.1;
    white-space: nowrap;
}
.widget-clock-date {
    font-size: clamp(0.7rem, 11cqmin, 2rem);
    color: #6c757d;
    margin-top: 2cqmin;
    white-space: nowrap;
}

/* 2. Ссылка */
.widget-link-btn {
    text-decoration: none;
    color: #212529;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4cqmin;
    width: 100%;
    height: 100%;
    text-align: center;
    padding: 4px;
    cursor: pointer !important;
}
.widget-link-icon {
    font-size: clamp(1.4rem, 34cqmin, 7rem);
    line-height: 1;
}
.widget-link-title {
    font-size: clamp(0.75rem, 13cqmin, 2.5rem);
    line-height: 1.2;
    word-break: break-word;
    max-width: 95%;
}

/* 3. Таймер */
.widget-timer-label {
    font-size: clamp(0.65rem, 11cqmin, 1.8rem);
    color: #6c757d;
    font-weight: 500;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.widget-timer-display {
    font-size: clamp(1.2rem, 26cqmin, 5.5rem);
    font-weight: 700;
    font-family: monospace;
    line-height: 1.1;
    margin: 2cqmin 0 4cqmin 0;
    color: #212529;
}
.timer-finished .widget-timer-display {
    color: #dc3545 !important;
}
.widget-timer-controls {
    display: flex;
    gap: 4cqmin;
}
.widget-timer-btn {
    font-size: clamp(0.7rem, 11cqmin, 1.8rem);
    padding: 2cqmin 6cqmin;
    border-radius: 6px;
    border: none;
    color: #fff;
    cursor: pointer !important;
    line-height: 1.2;
}

/* 4. QR-код */
.widget-qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 3cqmin;
}
.widget-qr-box {
    width: 84cqmin;
    height: 84cqmin;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
}
.widget-qr-wrap.has-caption .widget-qr-box {
    width: 72cqmin;
    height: 72cqmin;
}
.widget-qr-box svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
}
.widget-qr-caption {
    font-size: clamp(0.7rem, 10cqmin, 2.2rem);
    font-weight: 600;
    color: #212529;
    text-align: center;
    line-height: 1.2;
    max-width: 95%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qr-color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    cursor: pointer;
    transition: transform 0.15s;
}
.qr-color-swatch:hover {
    transform: scale(1.15);
}

/* 5. Праздники России */
.widget-holidays-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 2cqmin 3cqmin;
    text-align: left;
}
.widget-holidays-title {
    font-size: clamp(0.85rem, 6.2cqmin, 1.45rem);
    font-weight: 700;
    color: #1a1d20;
    margin-bottom: 3cqmin;
    flex-shrink: 0;
}
.widget-holidays-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}
.widget-holidays-list::-webkit-scrollbar,
.widget-rss-list::-webkit-scrollbar,
.doc-inline-body::-webkit-scrollbar,
.doc-multi-list::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
.widget-holidays-list::-webkit-scrollbar-thumb,
.widget-rss-list::-webkit-scrollbar-thumb,
.doc-inline-body::-webkit-scrollbar-thumb,
.doc-multi-list::-webkit-scrollbar-thumb {
    background: rgba(130, 130, 130, 0.4);
    border-radius: 4px;
}
.holiday-row {
    padding: 2.2cqmin 0;
    border-bottom: 1px solid #e9ecef;
}
.holiday-row:last-child {
    border-bottom: none;
}
.holiday-date {
    font-size: clamp(0.72rem, 4.6cqmin, 1.1rem);
    font-weight: 600;
    color: #198754;
    line-height: 1.25;
}
.holiday-name {
    font-size: clamp(0.78rem, 5cqmin, 1.2rem);
    color: #212529;
    line-height: 1.3;
}

/* 6. Календарь */
.widget-cal-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5cqmin 2cqmin;
}
.widget-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2cqmin;
    flex-shrink: 0;
}
.widget-cal-nav {
    width: clamp(24px, 9cqmin, 36px);
    height: clamp(24px, 9cqmin, 36px);
    border: none;
    border-radius: 8px;
    background-color: #e8f5ef;
    color: #198754;
    font-weight: 700;
    font-size: clamp(0.8rem, 5cqmin, 1.2rem);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    transition: background 0.15s;
}
.widget-cal-nav:hover {
    background-color: #d1e7dd;
}
.widget-cal-month {
    font-size: clamp(0.85rem, 6cqmin, 1.4rem);
    font-weight: 700;
    color: #1a1d20;
    text-transform: capitalize;
}
.widget-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1cqmin;
    flex: 1;
    align-items: center;
    text-align: center;
}
.cal-weekday {
    font-size: clamp(0.65rem, 4.4cqmin, 1rem);
    font-weight: 600;
    color: #6c757d;
    padding-bottom: 1cqmin;
}
.cal-weekday.weekend {
    color: #dc3545;
}
.cal-day {
    font-size: clamp(0.75rem, 5.2cqmin, 1.25rem);
    font-weight: 500;
    color: #212529;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    max-height: 11cqmin;
    border-radius: 8px;
}
.cal-day.weekend {
    color: #dc3545;
}
.cal-day.today {
    background-color: #1b7a5e;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(27, 122, 94, 0.3);
}

/* 7. Новости (RSS) */
.widget-rss-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 1.5cqmin 2.5cqmin;
    text-align: left;
}
.widget-rss-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5cqmin;
    flex-shrink: 0;
}
.widget-rss-title {
    font-size: clamp(0.85rem, 6cqmin, 1.45rem);
    font-weight: 700;
    color: #1a1d20;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.widget-rss-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 2.5cqmin;
}
.rss-item-card {
    display: flex;
    align-items: flex-start;
    gap: 3cqmin;
    padding-bottom: 2.5cqmin;
    border-bottom: 1px solid #e9ecef;
    text-decoration: none;
    color: inherit;
    cursor: pointer !important;
    transition: opacity 0.15s;
}
.rss-item-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.rss-item-card:hover .rss-item-title {
    color: #0d6efd;
    text-decoration: underline;
}
.rss-item-thumb {
    width: clamp(48px, 18cqmin, 86px);
    height: clamp(48px, 18cqmin, 86px);
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background-color: #f1f3f5;
    border: 1px solid #dee2e6;
}
.rss-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1cqmin;
}
.rss-item-date {
    font-size: clamp(0.68rem, 4.2cqmin, 0.95rem);
    font-weight: 600;
    color: #198754;
    line-height: 1.2;
}
.rss-item-title {
    font-size: clamp(0.76rem, 4.8cqmin, 1.15rem);
    font-weight: 600;
    color: #212529;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 8. Документ */
.widget-doc-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 3cqmin;
    padding: 4px;
    text-decoration: none;
    color: #212529;
    cursor: pointer !important;
}
.doc-badge-icon {
    width: clamp(42px, 28cqmin, 96px);
    height: clamp(42px, 28cqmin, 96px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: clamp(0.8rem, 9cqmin, 1.8rem);
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.doc-badge-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.65rem;
    flex-shrink: 0;
}
.doc-badge-pdf  { background: #fee2e2; color: #dc2626; }
.doc-badge-word { background: #dbeafe; color: #2563eb; }
.doc-badge-xls  { background: #dcfce7; color: #16a34a; }
.doc-badge-ppt  { background: #ffedd5; color: #ea580c; }
.doc-badge-file { background: #f1f5f9; color: #475569; }

.widget-doc-title {
    font-size: clamp(0.78rem, 11cqmin, 1.8rem);
    font-weight: 600;
    line-height: 1.25;
    max-width: 94%;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.widget-doc-meta {
    font-size: clamp(0.65rem, 7cqmin, 1rem);
    color: #6c757d;
}
.widget-doc-multi-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding: 1.5cqmin 2cqmin;
}
.doc-multi-header {
    font-size: clamp(0.85rem, 6cqmin, 1.35rem);
    font-weight: 700;
    color: #1a1d20;
    margin-bottom: 2cqmin;
    padding-right: 48px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.doc-multi-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 2px;
}
.doc-multi-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    background: #f8f9fa;
    text-decoration: none;
    color: #212529;
    cursor: pointer !important;
    transition: background 0.15s, border-color 0.15s;
}
.doc-multi-row:hover {
    background: #e9f5f0;
    border-color: #1b7a5e;
    color: #1b7a5e;
}
.doc-multi-row-name {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-multi-row-size {
    font-size: 0.72rem;
    color: #6c757d;
    flex-shrink: 0;
}
.widget-doc-inline {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding: 1cqmin;
}
.doc-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    padding-right: 52px;
}
.doc-inline-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1a1d20;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-inline-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 6px;
    flex-shrink: 0;
}
.doc-inline-tab {
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #495057;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer !important;
}
.doc-inline-tab.active {
    background: #1b7a5e;
    border-color: #1b7a5e;
    color: #ffffff;
}
.doc-inline-body {
    flex: 1;
    overflow: auto;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    position: relative;
    user-select: text;
    -webkit-user-select: text;
    cursor: default;
}
.doc-inline-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}
.doc-docx-content {
    padding: 14px 16px;
    background: #ffffff;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #212529;
}
.doc-docx-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}
.doc-docx-content td, .doc-docx-content th {
    border: 1px solid #dee2e6;
    padding: 4px 8px;
}
.doc-xlsx-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 0.82rem;
}
.doc-xlsx-table td, .doc-xlsx-table th {
    border: 1px solid #dee2e6;
    padding: 4px 8px;
    white-space: nowrap;
}
.doc-xlsx-table tr:first-child td {
    background: #f1f3f5;
    font-weight: 600;
}

/* 9. Видео */
.widget-video-wrap {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #000000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.widget-video-wrap iframe,
.widget-video-wrap video {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* 10. Пьедестал / Награждение */
.widget-podium-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    padding: 1.5cqmin 2cqmin 0 2cqmin;
    overflow: hidden;
}
.widget-podium-title {
    font-size: clamp(0.85rem, 6.5cqmin, 1.6rem);
    font-weight: 800;
    color: #1a1d20;
    text-align: center;
    margin-bottom: 1.5cqmin;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.podium-stage {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1.12fr 1fr;
    align-items: flex-end;
    gap: 2cqmin;
    min-height: 0;
    padding: 0 1cqmin;
}
.podium-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    min-width: 0;
}
.podium-trophy {
    width: clamp(32px, 16cqmin, 76px);
    height: clamp(32px, 16cqmin, 76px);
    flex-shrink: 0;
    margin-bottom: 1cqmin;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.16));
    transition: transform 0.25s ease;
}
.podium-col:hover .podium-trophy {
    transform: translateY(-4px) scale(1.06);
}
.podium-col.place-1 .podium-trophy {
    width: clamp(38px, 19cqmin, 88px);
    height: clamp(38px, 19cqmin, 88px);
}
.podium-winner-name {
    font-size: clamp(0.72rem, 5cqmin, 1.25rem);
    font-weight: 700;
    color: #1a1d20;
    text-align: center;
    line-height: 1.15;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 2px;
}
.podium-winner-value {
    font-size: clamp(0.68rem, 4.3cqmin, 1.05rem);
    font-weight: 700;
    padding: 0.4cqmin 2.2cqmin;
    border-radius: 999px;
    margin: 0.8cqmin 0 1.4cqmin 0;
    white-space: nowrap;
    max-width: 96%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.place-1 .podium-winner-value {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}
.place-2 .podium-winner-value {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.place-3 .podium-winner-value {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}
.podium-pedestal {
    width: 100%;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.65), 0 -2px 8px rgba(0, 0, 0, 0.06);
}
.podium-place-num {
    font-size: clamp(1.1rem, 11cqmin, 3rem);
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}
.place-1 .podium-pedestal {
    height: 44%;
    min-height: 36px;
    background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
    border: 1px solid #d97706;
    border-bottom: none;
}
.place-1 .podium-place-num {
    color: #78350f;
}
.place-2 .podium-pedestal {
    height: 31%;
    min-height: 28px;
    background: linear-gradient(180deg, #f1f5f9 0%, #94a3b8 100%);
    border: 1px solid #64748b;
    border-bottom: none;
}
.place-2 .podium-place-num {
    color: #1e293b;
}
.place-3 .podium-pedestal {
    height: 22%;
    min-height: 22px;
    background: linear-gradient(180deg, #fed7aa 0%, #c2410c 100%);
    border: 1px solid #9a3412;
    border-bottom: none;
}
.place-3 .podium-place-num {
    color: #fff7ed;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* 11. Эмблема и название организации */
.widget-org-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2cqmin;
    overflow: hidden;
}
.widget-org-wrap.layout-vertical {
    flex-direction: column;
    text-align: center;
    gap: 3cqmin;
}
.widget-org-wrap.layout-horizontal {
    flex-direction: row;
    text-align: left;
    gap: 5cqmin;
    padding: 2cqmin 4cqmin;
}
.widget-org-wrap.layout-logo-only {
    flex-direction: column;
    padding: 1.5cqmin;
}
.widget-org-logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.layout-vertical .widget-org-logo-box {
    width: 46cqmin;
    height: 46cqmin;
    max-width: 85%;
    max-height: 58%;
}
.layout-horizontal .widget-org-logo-box {
    width: 56cqmin;
    height: 56cqmin;
    max-width: 42%;
    max-height: 85%;
}
.layout-logo-only .widget-org-logo-box {
    width: 86cqmin;
    height: 86cqmin;
    max-width: 94%;
    max-height: 94%;
}
.widget-org-logo-box img,
.widget-org-logo-box video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}
.widget-org-text-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.layout-vertical .widget-org-text-box {
    align-items: center;
    max-width: 96%;
}
.layout-horizontal .widget-org-text-box {
    align-items: flex-start;
    flex: 1;
}
.widget-org-title {
    font-size: clamp(0.85rem, 11cqmin, 2.6rem);
    font-weight: 800;
    color: #1a1d20;
    line-height: 1.2;
    word-break: break-word;
}
.layout-horizontal .widget-org-title {
    font-size: clamp(0.9rem, 13cqmin, 2.8rem);
}
.widget-org-subtitle {
    font-size: clamp(0.7rem, 6.5cqmin, 1.35rem);
    font-weight: 500;
    color: #6c757d;
    line-height: 1.25;
    margin-top: 1.2cqmin;
    word-break: break-word;
}

/* --- ОКНО "ОФОРМЛЕНИЕ СТРАНИЦЫ" --- */
.width-choice-btn {
    border: 2px solid #dee2e6;
    background: #ffffff;
    color: #212529;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.width-choice-btn.active {
    border-color: #1b7a5e;
    background-color: #f0fdf9;
    color: #1b7a5e;
}
.anim-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px;
}
@media (max-width: 768px) {
    .anim-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.anim-choice-card {
    border-radius: 10px;
    border: 2px solid #dee2e6;
    padding: 7px 5px;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
    transition: border-color 0.15s, transform 0.15s, background-color 0.15s;
}
.anim-choice-card:hover {
    transform: translateY(-2px);
    background-color: #f8f9fa;
}
.anim-choice-card.active {
    border-color: #1b7a5e;
    background-color: #f0fdf9;
    box-shadow: 0 0 0 2px rgba(27, 122, 94, 0.25);
}
.anim-choice-icon {
    font-size: 1.3rem;
    line-height: 1.1;
}
.anim-choice-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: #212529;
    line-height: 1.15;
}
.bg-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
}
@media (max-width: 768px) {
    .bg-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.bg-choice-card {
    height: 74px;
    border-radius: 10px;
    border: 2px solid #dee2e6;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f3f5;
    transition: border-color 0.15s, transform 0.15s;
}
.bg-choice-card:hover {
    transform: scale(1.02);
}
.bg-choice-card.active {
    border-color: #1b7a5e;
    box-shadow: 0 0 0 2px rgba(27, 122, 94, 0.35);
}
.bg-choice-label {
    position: absolute;
    bottom: 4px;
    left: 5px;
    background: rgba(0, 0, 0, 0.62);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 5px;
    max-width: calc(100% - 10px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- РАЗГРАНИЧЕНИЕ ПРАВ: СУПЕРАДМИН, РЕДАКТОР И ГОСТЬ --- */
body.mode-viewer .admin-only,
body.mode-viewer .superadmin-only {
    display: none !important;
}
body.mode-admin .guest-only {
    display: none !important;
}
body:not(.is-superadmin) .superadmin-only {
    display: none !important;
}

body.mode-viewer .grid-stack-item-content {
    cursor: default;
    border-style: solid;
}
body.mode-viewer .widget-actions,
body.mode-viewer .ui-resizable-handle {
    display: none !important;
}
body.mode-viewer .board-stage {
    border-color: transparent;
    box-shadow: none;
}

.user-row-card {
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 12px 14px;
    background: #ffffff;
}
.user-row-card.is-blocked {
    background: #fff5f5;
    border-color: #fecaca;
}
/* Размеры шрифта для эмблемы */
.font-size-sm .widget-org-title { font-size: clamp(0.7rem, 7cqmin, 1.4rem); }
.font-size-md .widget-org-title { font-size: clamp(0.85rem, 11cqmin, 2.4rem); }
.font-size-lg .widget-org-title { font-size: clamp(1rem, 15cqmin, 3.4rem); }
.font-size-xl .widget-org-title { font-size: clamp(1.2rem, 19cqmin, 4.5rem); }
/* Плашки-чекбоксы выбора дашбордов в окне пользователей */
.page-perm-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #ced4da;
    background-color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    color: #212529;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background-color 0.15s;
}
.page-perm-pill:hover {
    border-color: #1b7a5e;
    background-color: #f8fafc;
}
.page-perm-pill input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #1b7a5e;
    cursor: pointer;
    flex-shrink: 0;
}
.page-perm-pill:has(input[type="checkbox"]:checked) {
    border-color: #1b7a5e;
    background-color: #f0fdf9;
    color: #1b7a5e;
    font-weight: 600;
}
/* Кнопка скрытия виджета (глазик) */
.btn-hide-widget {
    background: rgba(108, 117, 125, 0.14);
    color: #495057;
}
.btn-hide-widget:hover {
    background: #495057;
    color: #fff;
}
.grid-stack-item-content.widget-hidden-for-guests {
    opacity: 0.55;
    border: 2px dashed #adb5bd !important;
}
.grid-stack-item-content.widget-hidden-for-guests::after {
    content: "Скрыт от гостей";
    position: absolute;
    bottom: 4px;
    left: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    background: #6c757d;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
}

/* Стили виджета "Файлы" */
.widget-files-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 1.5cqmin 2.5cqmin;
    text-align: left;
}
.widget-files-title {
    font-size: clamp(0.85rem, 6cqmin, 1.45rem);
    font-weight: 700;
    color: #1a1d20;
    margin-bottom: 2cqmin;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.widget-files-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 2px;
}
.widget-files-list::-webkit-scrollbar {
    width: 4px;
}
.widget-files-list::-webkit-scrollbar-thumb {
    background: rgba(130,130,130,0.4);
    border-radius: 4px;
}
.file-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    background: #f8f9fa;
    text-decoration: none;
    color: #212529;
    cursor: pointer !important;
    transition: background 0.15s, border-color 0.15s;
}
.file-item-row:hover {
    background: #e9f5f0;
    border-color: #1b7a5e;
    color: #1b7a5e;
}
.file-item-name {
    flex: 1;
    min-width: 0;
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-item-size {
    font-size: 0.7rem;
    color: #6c757d;
    flex-shrink: 0;
}
/* --- 13. ВИДЖЕТ "ПРИЁМ ФАЙЛОВ ОТ ПОЛЬЗОВАТЕЛЕЙ" (DROPBOX) --- */
.widget-dropbox-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    padding: 1.5cqmin 2.5cqmin;
    text-align: left;
}
.widget-dropbox-title {
    font-size: clamp(0.88rem, 6cqmin, 1.4rem);
    font-weight: 700;
    color: #1a1d20;
    margin-bottom: 0.6cqmin;
}
.widget-dropbox-desc {
    font-size: clamp(0.72rem, 4.2cqmin, 0.95rem);
    color: #6c757d;
    margin-bottom: 1.5cqmin;
    line-height: 1.25;
}
.dropbox-form-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}
.dropbox-file-zone {
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer !important;
    transition: border-color 0.15s, background 0.15s;
}
.dropbox-file-zone:hover {
    border-color: #1b7a5e;
    background: #f0fdf9;
}
/* Режим прямой ссылки для класса (?lock=1): скрываем список других страниц для гостей */
body.mode-viewer.locked-page #dashboardSelect {
    display: none !important;
}