/*
 * ProLibra Theme — дашборд на главной странице сотрудника.
 * Плитки Кохи скрываются здесь, в <head>, до отрисовки. Дашборд строит скрипт;
 * у всех блоков заранее заданы высоты, поэтому цифры и таблица появляются без сдвигов.
 * Если скрипт не сработал, на <body> ставится .plt-dash-failed и плитки возвращаются.
 */
body#main_intranet-main #container-main > .row { display: none; }
body#main_intranet-main.plt-dash-failed #container-main > .row { display: flex; }
@media print { body#main_intranet-main #container-main > .row { display: flex; } .plt-dash { display: none; } }

.plt-dash { width: 100%; max-width: 1320px; box-sizing: border-box; min-width: 0; padding: 8px 8px 32px; display: flex; flex-direction: column; gap: 20px; color: var(--plt-text); }
/* Заголовок и кнопки — друг под другом: при увеличении масштаба кнопки переносятся, а не уходят за край */
.pd-head { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.pd-head > div:first-child { max-width: 100%; min-width: 0; }
.pd-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.3px; line-height: 32px; height: 32px; color: var(--plt-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-sub { margin: 4px 0 0; color: var(--plt-muted); font-size: 14px; line-height: 18px; min-height: 18px; }
.pd-time { font-variant-numeric: tabular-nums; color: var(--plt-text); font-weight: 600; }
.pd-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.pd-action { height: 40px; display: inline-flex !important; align-items: center; gap: 8px; padding: 0 16px !important; border-radius: 10px !important; font-weight: 600; font-size: 13px; text-decoration: none !important; }
.pd-action svg { width: 16px; height: 16px; flex: 0 0 16px; }

.pd-card { background: var(--plt-surface); border: 1px solid var(--plt-border); border-radius: 14px; padding: 18px 20px; box-sizing: border-box; }
.pd-card h2, .pd-card h3 { margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--plt-text); opacity: 1; }

.pd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 16px; }
.pd-kpi { display: flex; flex-direction: column; gap: 6px; height: 118px; }
.pd-kpi-label { color: var(--plt-muted); font-size: 13px; line-height: 16px; }
.pd-kpi-num { font-size: 32px; font-weight: 800; letter-spacing: -.5px; line-height: 38px; height: 38px; color: var(--plt-text); font-variant-numeric: tabular-nums; }
.pd-kpi-num.is-loading { color: transparent; background: var(--plt-th); border-radius: 8px; width: 72px; }
.pd-kpi-num.is-warn { color: var(--plt-danger, #b4361e); }
.pd-kpi-new_patrons_month .pd-kpi-num:not(.is-loading) { color: var(--plt-primary-ink); }
.pd-kpi-note { color: var(--plt-muted); font-size: 12px; line-height: 16px; height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pd-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.pd-loans { flex: 2 1 min(520px, 100%); min-width: 0; min-height: 384px; }
.pd-side { flex: 1 1 min(300px, 100%); min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pd-card-head { display: flex; justify-content: space-between; align-items: center; }
.pd-table-wrap { overflow-x: auto; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.pd-table th { text-align: left; font-weight: 500; color: var(--plt-muted); padding: 10px 8px; border-bottom: 1px solid var(--plt-border); background: transparent !important; }
.pd-table th:nth-child(1) { width: 26%; }
.pd-table th:nth-child(3) { width: 18%; }
.pd-table th:nth-child(4) { width: 18%; }
.pd-table td { height: 44px; padding: 0 8px; border-bottom: 1px solid var(--plt-th); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-table td a { color: var(--plt-text); text-decoration: none; }
.pd-table td a:hover { color: var(--plt-primary-ink); text-decoration: underline; }
.pd-table th, .pd-table td { border-left: 0 !important; border-right: 0 !important; border-top: 0 !important; }
.pd-table tr, .pd-table tr:nth-child(odd) td, .pd-table tr:nth-child(even) td { background: transparent !important; }
.pd-table tbody tr:hover td { background: var(--plt-primary-soft) !important; }
.pd-skel { display: block; height: 12px; width: 70%; border-radius: 6px; background: var(--plt-th); }
.pd-badge { font-size: 12px; border-radius: 6px; padding: 3px 8px; white-space: nowrap; }
.pd-badge.is-loan { background: var(--plt-primary-soft); color: var(--plt-primary-ink); }
.pd-badge.is-overdue { background: var(--plt-danger-soft, #fbe9e5); color: var(--plt-danger-ink, #9a2c17); }
.pd-empty { color: var(--plt-muted); padding: 12px 0; white-space: normal !important; }

/* Блоки Кохи (новости, «Требует внимания»), перенесённые в карточки */
.pd-card > .page-section { border: 0 !important; border-radius: 0 !important; padding: 0 !important; margin: 0 !important; background: transparent !important; box-shadow: none !important; }
.pd-card #area-news .newsitem { padding-left: 0; padding-right: 0; }
.pd-attention .pending-info { margin: 6px 0; display: flex; justify-content: space-between; gap: 8px; }
.pd-version { color: var(--plt-muted); font-size: 12px; text-align: right; }

/* ---------------------------------------------------------------- модули справа
 * Колонка фиксированной ширины, кнопки фиксированной высоты: ничего не сдвигается при загрузке.
 * Тёмные кнопки — цвет панели навигации, текст белый (или тёмный, если панель светлая). */
.plt-home { display: block; }
.plt-home.has-modules { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; max-width: 1640px; }
.plt-home.has-modules > .plt-dash { max-width: none; }
.pd-modules { position: sticky; top: 12px; margin-top: 8px; background: var(--plt-surface); border: 1px solid var(--plt-border); border-radius: 14px; padding: 16px; box-sizing: border-box; }
.pd-modules-title { margin: 0 0 12px; font-size: 16px; font-weight: 700; line-height: 20px; color: var(--plt-text); }
.pd-modules-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-modules-list > li { margin: 0; padding: 0; }
a.pd-module, a.pd-module:link, a.pd-module:visited {
    display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px; box-sizing: border-box;
    border-radius: 10px; background: var(--plt-module-bg, var(--plt-nav)); color: var(--plt-module-text, var(--plt-nav-text)) !important;
    font-size: 14px; font-weight: 600; line-height: 1; text-decoration: none !important;
    transition: background-color .15s ease;
}
a.pd-module:hover, a.pd-module:focus-visible { background: var(--plt-primary); color: var(--plt-on-primary) !important; }
a.pd-module:focus-visible { outline: 2px solid var(--plt-primary); outline-offset: 2px; }
.pd-module-ico { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.12); font-size: 14px; }
.pd-module-ico i { color: inherit !important; width: auto; }
.pd-module-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Узкий экран / крупный масштаб: модули под дашбордом, плиткой в несколько колонок */
@media (max-width: 1100px) {
    .plt-home.has-modules { display: block; }
    .pd-modules { position: static; margin: 0 8px 24px; }
    .pd-modules-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
}
@media print { .pd-modules { display: none; } }

/* ---------------------------------------------------------------- элементы других плагинов ProLibra */
a.pd-kpi, a.pd-kpi:link, a.pd-kpi:visited { color: inherit; text-decoration: none !important; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
a.pd-kpi:hover, a.pd-kpi:focus-visible { border-color: var(--plt-primary); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
a.pd-kpi:focus-visible { outline: 2px solid var(--plt-primary); outline-offset: 2px; }
.pd-kpi-ext .pd-kpi-num:not(.is-loading) { color: var(--plt-primary-ink); }
.pd-module-ico svg { width: 16px; height: 16px; }

/* 1.16.0 — блоки других плагинов в правой колонке (например, «Фонд библиотеки» из ProLibFund) */
.pd-panel { display: flex; flex-direction: column; gap: 6px; }
.pd-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pd-panel-head h2 { margin: 0; }
.pd-panel-go { color: var(--plt-muted); font-size: 22px; line-height: 1; }
.pd-panel .pd-kpi-num:not(.is-loading) { color: var(--plt-primary-ink); }
a.pd-panel, a.pd-panel:link, a.pd-panel:visited { color: inherit; text-decoration: none !important; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
a.pd-panel:hover, a.pd-panel:focus-visible { border-color: var(--plt-primary); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
a.pd-panel:hover .pd-panel-go { color: var(--plt-primary-ink); }
a.pd-panel:focus-visible { outline: 2px solid var(--plt-primary); outline-offset: 2px; }
