/**
 * IMS2 Application Stylesheet
 * UIKit overrides and custom styles
 */

/* ===== CSS VARIABLES ===== */
:root {
  /* Акцент шапки меню/логин-экрана/заголовков форм — раньше был зашит
     отдельным фиолетовым независимо от темы. Теперь берётся из --app-header-bg
     активной темы: обычно это градиент акцента (var(--primary-color)/
     var(--primary-active)), но не обязательно — Gruvbox, например, держит
     акцент только на мелких элементах (кнопки/фокус/текст), а для шапки
     задаёт тёмный нейтральный градиент вместо акцентного (см. gruvbox.css —
     иначе шапка входа/диалогов выглядит чужеродно ярко на его тёмной
     палитре). --primary/--primary-dark — тоже из темы, для мелких акцентов
     (кнопки/фокус), которые в любой теме красятся акцентом. */
  --primary: var(--primary-color);
  --primary-dark: var(--primary-active);
  --header-gradient: var(--app-header-bg);

  /* Поверхности/таблица — берутся из активной темы (--app-* определены в
     modern.css/tabulator.css), а не хардкожены здесь. Раньше были прибиты
     светлые значения напрямую — из-за этого смена темы на tabulator давала
     нечитаемый зелёный текст на белом фоне. */
  --table-header-bg: var(--app-table-header-bg);
  --table-row-odd: var(--app-table-row-odd);
  --table-row-even: var(--app-table-row-even);
  --table-hover: var(--app-table-hover);
  --border-light: var(--border-color-light);
  --text-color: var(--text-primary);
  --text-muted: var(--text-secondary);
  --bg-gray: var(--app-panel-body-bg);

  /* ── Правила оформления кнопок (все формы) ─────────────────────────────
   * Все кнопки на всех панелях используют эти переменные.
   * Менять здесь — изменится везде.
   *
   * Обычная кнопка:   серый фон, чёрный текст, белый контур (text-shadow)
   * Primary кнопка:   синий фон, белый текст, чёрный контур
   * Hover обычной:    синяя рамка и текст
   * Размер toolbar:   padding 2px 10px, font 12px
   * Размер footer:    padding 2px 10px, font 12px  (одинаково с toolbar)
   * ──────────────────────────────────────────────────────────────────────── */
  --btn-bg:          #c0c0c0;
  --btn-border:      #999;
  --btn-color:       #000;
  --btn-padding:     2px 10px;
  --btn-font:        12px;
  --btn-radius:      4px;
  --btn-text-shadow: -0.5px -0.5px 0 #fff, 0.5px -0.5px 0 #fff,
                     -0.5px  0.5px 0 #fff, 0.5px  0.5px 0 #fff;

  /* Обратная совместимость со старыми именами */
  --button-bg:     var(--btn-bg);
  --button-border: var(--btn-border);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: Arial, sans-serif;
  /* Responsive font: scales between 13px and 15px for large screens */
  font-size: clamp(0.8125rem, 1vw + 0.25rem, 0.95rem);
  color: var(--text-color);
}

body {
  background: var(--app-page-bg);
  /* Десктоп-ориентированное приложение (не адаптировано под мобильные
     ширины, см. UIKit responsiveness audit 2026-07-28) — гарантируем, что
     раскладка НИКОГДА не сжимается/не ломается: если окно уже, чем
     min-width на #app ниже, просто появляется горизонтальный скролл. */
  overflow-x: auto;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* Порог — с запасом над самым широким диалогом в приложении (~1140px),
     не под весь 14" экран (1920px) — иначе скролл ловил бы и обычное
     окно не на весь экран (например, в пол-экрана рядом с другим окном). */
  min-width: 1280px;
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-gray);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

/* ===== UIKIT OVERRIDES ===== */

/* Hide empty elements in all components */
.ui-dialog-content:empty,
.ui-panel-content:empty,
.ui-panel-body:empty,
.ui-panel-footer:empty {
  display: none !important;
  min-height: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Dialog */
.ui-dialog {
  background: var(--app-surface);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  min-width: 0 !important;
  max-width: none !important;
  margin: auto !important;
}

/* Override dialog constraints to allow custom sizing */
@media (min-width: 768px) {
  .ui-dialog {
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
  }
}

/* Override dropdown menu constraints */
.ui-dropdown-menu {
  min-width: 0 !important;
  width: auto !important;
}

/* Override datepicker popup constraints */
.ui-datepicker-popup {
  min-width: 0 !important;
  width: auto !important;
}

/* Override grid filter popup constraints */
.ui-grid-filter-popup {
  min-width: 0 !important;
  width: auto !important;
}

.ui-dialog-header {
  /* Responsive padding: scales between 12px and 20px */
  padding: clamp(0.75rem, 2vw, 1.25rem) clamp(1rem, 3vw, 1.5rem);
  border-bottom: 1px solid var(--border-color);
  background: var(--app-header-bg);
  border-radius: 8px 8px 0 0;
  color: white;
}

.ui-dialog-body,
.ui-dialog-content {
  /* Responsive padding: scales between 16px and 24px */
  padding: clamp(1rem, 3vw, 1.5rem);
  overflow: auto;
  /* No max-height here: the dialog body must fill the dialog via flex:1.
     The dialog itself is bounded by max-height:90vh, so content can never
     overflow the viewport. A fixed max-height:70vh capped the body below
     the dialog height and left an empty gap under the content on tall
     (custom-height) dialogs like ReferenceDialog. */
}

.ui-dialog-footer {
  padding: 4px 8px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-gray);
  display: flex;
  justify-content: flex-start;
  gap: 4px;
  flex-wrap: wrap;
}

.ui-dialog-footer button {
  padding: var(--btn-padding) !important;
  font-size: var(--btn-font) !important;
  color: var(--btn-color) !important;
  background: var(--btn-bg) !important;
  border: 1px solid var(--btn-border) !important;
  border-radius: var(--btn-radius) !important;
  text-shadow: var(--btn-text-shadow) !important;
}

/* Primary button in footer — белый текст, чёрный контур (инверсия --btn-text-shadow) */
.ui-dialog-footer button.primary {
  color: #fff !important;
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  text-shadow: -0.5px -0.5px 0 #000, 0.5px -0.5px 0 #000,
               -0.5px  0.5px 0 #000, 0.5px  0.5px 0 #000 !important;
}

.ui-dialog-footer button.primary:hover:not(:disabled) {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

.ui-dialog-footer button.danger {
  color: white !important;
  background: var(--error-color) !important;
  border-color: var(--error-color) !important;
}

/* Panel */
#menuScreen.ui-panel,
.ui-panel {
  background: var(--app-surface);
  border-radius: 0;
  box-shadow: none;
  border: none;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

#menuScreen .ui-panel-header,
.ui-panel-header {
  padding: 0;
  border: none;
  background: var(--header-gradient);
  color: white;
  min-height: auto;
  flex-shrink: 0;
}

#menuScreen .ui-panel-content {
  flex: 1;
  overflow: auto;
  padding: 0;
  background: var(--bg-gray);
}

.ui-panel-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  background: var(--bg-gray);
}

.ui-panel-footer {
  border-top: 1px solid var(--border-color);
  padding: 10px 20px;
  background: var(--app-surface);
  flex-shrink: 0;
}

/* Main (pre-login) screen — акцент берётся из активной темы (--header-gradient),
   раньше был зашит фиолетовый напрямую в shell.js инлайном. */
.main-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--header-gradient);
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.main-screen-content {
  text-align: center;
  color: white;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.main-screen-logo {
  width: 120px;
  height: 120px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 20px;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.3);
}

.main-screen-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
  color: white;
}

.main-screen-subtitle {
  font-size: 14px;
  opacity: 0.9;
  color: white;
}

.ui-button.main-screen-access-btn {
  margin-top: 30px;
  padding: 10px 20px;
  background: white;
  color: var(--primary-color);
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

/* Переключатель темы на экране входа */
.theme-switcher {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
}

.theme-switcher-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
}

.theme-switcher-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.theme-switcher-btn.active {
  background: white;
  color: var(--primary-color);
  font-weight: bold;
  border-color: white;
}

/* Переключатель языка на экране входа — отдельно от темы (top-right),
   чтобы кнопки не сливались в одну строку; выровнен влево. */
.lang-switcher {
  position: absolute;
  top: 12px;
  left: 12px;
  right: auto;
}

/* Menu Screen Container */
#menuScreen {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--app-surface) !important;
}

/* Hide unnecessary panel bodies in menu */
#menuScreen .ui-panel {
  background: transparent !important;
}

#menuScreen .ui-panel-content,
#menuScreen .ui-panel-body {
  background: transparent !important;
}

/* Restore needed backgrounds */
#menuScreen .menu-user-header {
  background: var(--header-gradient) !important;
}

#menuScreen .menu-buttons-header {
  background: var(--header-gradient) !important;
}

#menuScreen .menu-button-bar {
  background: var(--bg-gray) !important;
}

#menuScreen.visible {
  display: flex !important;
}


.menu-logout-btn {
  padding: clamp(0.3rem, 0.8vw, 0.6rem) clamp(0.6rem, 1.5vw, 1rem) !important;
  background: rgba(255,255,255,0.2) !important;
  color: white !important;
  border: 1px solid rgba(255,255,255,0.4) !important;
  border-radius: 4px !important;
  font-size: clamp(0.7rem, 0.8vw + 0.3rem, 0.9rem) !important;
  font-weight: bold !important;
}

.menu-logout-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.3) !important;
}

/* Buttons Panel (middle) */
.menu-buttons-panel {
  flex-shrink: 0 !important;
  height: auto !important;
}

/* Hide all footers and empty content in menu panels */
#menuScreen .ui-panel-footer,
#menuScreen .ui-panel-content,
#menuScreen .ui-panel-body {
  display: none !important;
}

/* Clean up menu panel structure */
.menu-user-panel,
.menu-buttons-panel {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

#menuScreen > div {
  background: transparent !important;
}

.menu-buttons-header {
  padding: 4px clamp(1rem, 3vw, 1.5rem) !important;
  background: var(--header-gradient) !important;
  color: white !important;
  border: none !important;
}

.menu-button-bar {
  padding: clamp(0.6rem, 1.5vw, 1.2rem) clamp(1rem, 3vw, 1.5rem);
  background: var(--bg-gray);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.25rem, 0.5vw, 0.5rem);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.menu-button-bar button {
  padding: clamp(0.4rem, 1vw, 0.8rem) clamp(0.6rem, 1.5vw, 1rem) !important;
  font-size: clamp(0.7rem, 0.8vw + 0.3rem, 0.9rem) !important;
  background: #d0d0d0 !important;
  border: 1px solid #999 !important;
  border-radius: 4px !important;
  color: #333 !important;
  font-weight: bold !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  outline: none !important;
  box-shadow: 2px 3px 6px rgba(0,0,0,0.25) !important;
}

.menu-button-bar button:hover:not(:disabled) {
  background: #c0c0c0 !important;
}

.menu-button-bar button:focus:not(:disabled) {
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

.menu-button-bar button.active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

.menu-button-bar button.active:hover:not(:disabled) {
  background: var(--primary-hover) !important;
  color: white !important;
}


/* Button */
.ui-button {
  padding: clamp(0.4rem, 1vw, 0.8rem) clamp(0.8rem, 2vw, 1.2rem);
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 4px;
  color: #000;
  font-weight: bold;
  font-size: clamp(0.75rem, 1vw + 0.2rem, 0.9rem);
  cursor: pointer;
  transition: all 0.2s;
}

.ui-button:hover:not(:disabled) {
  background: #d0d0d0;
}

.ui-button:active:not(:disabled) {
  background: #a0a0a0;
  color: white;
}

.ui-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ui-button.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.ui-button.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.ui-button.danger {
  background: var(--error-color);
  color: white;
  border-color: var(--error-color);
}

.ui-button.danger:hover:not(:disabled) {
  background: #fa5252;
}

/* Input, Textarea, Dropdown */
.ui-input,
.ui-textarea,
.ui-dropdown {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: clamp(0.8rem, 1vw + 0.2rem, 1rem);
  font-family: Arial, sans-serif;
}

/* Однострочные контролы: вертикальный padding=0, вертикальное центрирование
   значения задаётся line-height=высоте в modern.css (.ui-input). Раньше здешний
   симметричный padding перебивал это и проваливал текст к низу. Textarea
   многострочная — ей симметричный padding нужен. */
.ui-input,
.ui-dropdown {
  padding: 0 clamp(0.4rem, 1vw, 0.8rem);
}

.ui-textarea {
  padding: clamp(0.4rem, 1vw, 0.8rem);
}

.ui-input:focus,
.ui-textarea:focus,
.ui-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 4px rgba(102, 126, 234, 0.2);
}

/* Grid */
.ui-grid {
  width: 100%;
  border: 1px solid var(--border-color);
  border-collapse: collapse;
  font-size: clamp(0.8rem, 1vw + 0.2rem, 1rem);
  background: var(--app-surface);
}

.ui-grid thead {
  background: var(--table-header-bg);
  color: white;
}

.ui-grid th {
  padding: clamp(0.6rem, 1vw, 1rem) clamp(0.4rem, 1.5vw, 0.8rem);
  text-align: left;
  font-weight: bold;
  border: none;
  user-select: none;
}

.ui-grid td {
  padding: clamp(0.5rem, 1vw, 0.9rem) clamp(0.4rem, 1.5vw, 0.8rem);
  border-bottom: 1px solid var(--border-light);
}

.ui-grid tbody tr:nth-child(odd) {
  background: var(--table-row-odd);
}

.ui-grid tbody tr:nth-child(even) {
  background: var(--table-row-even);
}

.ui-grid tbody tr:hover {
  background: var(--table-hover);
}

.ui-grid tbody tr:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.ui-grid tbody tr.focused {
  background: var(--app-table-hover) !important;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.ui-grid tbody tr.current-row {
  background: var(--app-table-selected) !important;
  border-left: 3px solid var(--primary-color, var(--primary));
  box-shadow: inset 0 0 0 1px var(--primary-color, var(--primary));
}

.ui-grid {
  outline: none !important;
}

.ui-grid:focus {
  outline: none !important;
}

/* Filter button in header - visible on dark background */
.ui-grid-filter-btn {
  opacity: 0.8 !important;
  color: white;
  font-size: 16px;
}

.ui-grid-filter-btn:hover {
  opacity: 1 !important;
}

/* Form */
.ui-form {
  display: flex;
  flex-direction: column;
  gap: clamp(0.8rem, 2vw, 1.2rem);
}

.ui-form-field {
  display: flex;
  flex-direction: column;
  gap: clamp(0.25rem, 0.5vw, 0.5rem);
}

.ui-form-label {
  font-weight: bold;
  font-size: clamp(0.7rem, 0.8vw + 0.3rem, 0.9rem);
  color: var(--text-color);
}

.ui-form-error {
  color: var(--error-color);
  font-size: clamp(0.65rem, 0.7vw + 0.2rem, 0.8rem);
  margin-top: 0.125rem;
}

/* ===== UTILITIES ===== */

.hidden {
  display: none !important;
}

.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.flex-row {
  display: flex;
  flex-direction: row;
  gap: clamp(0.6rem, 1.5vw, 1rem);
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 1.5vw, 1rem);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.mt-1 { margin-top: 0.3125rem; }
.mt-2 { margin-top: 0.625rem; }
.mb-1 { margin-bottom: 0.3125rem; }
.mb-2 { margin-bottom: 0.625rem; }
.p-1 { padding: 0.3125rem; }
.p-2 { padding: 0.625rem; }

/* ===== REFERENCE DIALOG LAYOUT ===== */
.ref-dialog-container {
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

.ref-dialog-grid {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
}

.ref-dialog-buttons {
  display: flex !important;
  gap: 8px !important;
  padding: 4px 6px !important;
  flex-shrink: 0 !important;
  background: var(--bg-gray) !important;
  border-top: 1px solid var(--border-color) !important;
  margin-top: auto !important;
}

/* ===== New Document Dialog ===== */
.nd-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  min-width: 440px;
}

.nd-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nd-label {
  width: 110px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
}

.nd-input {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 13px;
  /* Идеология цвета полей (см. modern.css): песочный — свободный ввод,
     зелёный — выбор из списка. Здесь все .nd-input, кроме readOnly-полей
     выбора через справочник (кнопка "↗"), — свободный текст. */
  background: var(--bg-field-text);
  color: var(--text-primary);
}

.nd-input:read-only {
  /* readOnly + кнопка "↗" = выбор значения из справочника, не свободный ввод. */
  background: var(--bg-field-choice, #eaf7ee);
  cursor: default;
}

.nd-input[type="date"] {
  background: var(--bg-field-choice, #eaf7ee);
  cursor: pointer;
}

/* UIKit Input/DatePicker внутри nd-row занимают всё доступное место */
.nd-row .ui-input,
.nd-row .ui-datepicker-wrapper { flex: 1; }

/* ── DocumentViewDialog ────────────────────────────────────── */

.dv-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0;
}

.dv-info {
  display: flex;
  gap: 24px;
  padding: 10px 14px 8px;
  background: var(--bg-gray);
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}

.dv-info-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.dv-info-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 13px;
}

.dv-info-label {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  min-width: 110px;
  flex-shrink: 0;
}

.dv-info-value {
  color: var(--text-primary);
  font-weight: 500;
}

.dv-grid-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dv-grid-wrap .ui-grid {
  height: 100%;
}

.dv-status {
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-gray);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* ── DokPriDialog (и другие формы документов) ──────────────── */

/* ── doc-toolbar: документные действия (верхняя панель форм Dok*Dialog) ── */
.doc-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-gray, #f5f5f5);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Кнопки тулбара = стиль footer-кнопок, но compact */
.doc-toolbar-btn {
  padding: var(--btn-padding);
  font-size: var(--btn-font);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--btn-radius);
  cursor: pointer;
  color: var(--btn-color);
  text-shadow: var(--btn-text-shadow);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.doc-toolbar-btn:hover {
  border-color: var(--primary-hover);
  color: var(--primary-hover);
}

.doc-toolbar-btn:active {
  border-color: var(--primary-active);
  color: var(--primary-active);
}

/* DropdownMenu в doc-toolbar — тот же стиль что doc-toolbar-btn */
.doc-toolbar .ui-dropdown-btn {
  padding: var(--btn-padding);
  font-size: var(--btn-font);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--btn-radius);
  color: var(--btn-color);
  text-shadow: var(--btn-text-shadow);
  height: auto !important;
  min-height: unset !important;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.doc-toolbar .ui-dropdown-btn:hover {
  border-color: var(--primary-hover);
  color: var(--primary-hover);
}

.doc-toolbar .ui-dropdown-btn-open {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: #fff !important;
}

.dpri-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.dpri-header {
  display: flex;
  gap: 20px;
  padding: 10px 14px 8px;
  background: var(--bg-gray);
  border-bottom: 1px solid var(--border-color-light);
  flex-shrink: 0;
}

.dpri-hcol {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.dpri-hrow {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 13px;
}

.dpri-hlabel {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  min-width: 80px;
  flex-shrink: 0;
}

.dpri-hvalue {
  color: var(--text-primary);
  font-weight: 500;
}

.dpri-comment-input {
  flex: 1;
  font-size: 13px;
  padding: 2px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  background: var(--bg-field-text);
  min-width: 0;
}

.dpri-grid-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dpri-grid-wrap .ui-grid {
  height: 100%;
}

.docs-statusbar {
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-gray);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.dpri-status {
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-gray);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* ── ToolsDialog ──────────────────────────────────────────────────────────── */

.tools-btn {
  padding: 8px 12px;
  font-size: 13px;
  background: var(--bg-lighter);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
}

.tools-btn:hover {
  background: var(--app-table-hover);
  border-color: var(--border-color-hover);
}

.tools-btn:active {
  background: var(--app-table-selected);
}

/* Заглушки — инструмент ещё не реализован по-настоящему (см. ToolsDialog.js `stubs`) */
.tools-btn-stub {
  background: var(--bg-lighter);
  border-color: var(--border-color);
  color: var(--text-disabled);
}

.tools-btn-stub:hover {
  background: var(--bg-lightest);
  border-color: var(--border-color);
}
