html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

code {
  color: inherit;
  background-color: transparent;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.875em;
}

h1:focus {
  outline: none;
}

.blazor-error-boundary {
  background: #b32121;
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}

.blazor-error-boundary::after {
  content: "Произошла ошибка приложения.";
}

#app-initial-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #fff;
  z-index: 9999;
}

.app-initial-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e0e0e0;
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
}

.app-initial-text {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: #555;
}

/* Спиннер авторизации (Authorizing template внутри AuthorizeRouteView) */
.app-auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.app-auth-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
}

@keyframes app-spin {
  to { transform: rotate(360deg); }
}

/* Reconnect dialog */
#components-reconnect-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
#components-reconnect-modal.components-reconnect-hide {
  display: none;
}
#components-reconnect-modal .components-reconnect-dialog {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  max-width: 360px;
}
#components-reconnect-modal .components-reconnect-dialog p {
  margin: 0.8rem 0;
  font-size: 0.95rem;
  color: #333;
}
#components-reconnect-modal .components-reconnect-dialog button {
  margin-top: 0.5rem;
  padding: 0.5rem 1.5rem;
  border: none;
  border-radius: 6px;
  background: var(--rz-primary, #4f46e5);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}
#components-reconnect-modal .components-reconnect-dialog button:hover {
  opacity: 0.9;
}
#components-reconnect-modal .components-rejoining-animation {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 0.5rem;
}
#components-reconnect-modal .components-rejoining-animation > div {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rz-primary, #4f46e5);
  animation: reconnect-pulse 1.2s infinite ease-in-out;
}
#components-reconnect-modal .components-rejoining-animation > div:nth-child(2) {
  animation-delay: 0.3s;
}
@keyframes reconnect-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.icon-rail {
  width: 56px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  z-index: 100;
}

.rail-brand {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-bottom: 1px solid #e2e8f0;
}

.rail-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  gap: 2px;
  overflow-y: auto;
}

.rail-group {
  position: relative;
}

.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 48px;
  cursor: pointer;
  color: #64748b;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.rail-item .rzi { font-size: 1.25rem; }

.rail-label {
  font-size: 0.55rem;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.rail-item:hover {
  background: #f1f5f9;
  color: #334155;
}

.rail-item.active {
  color: var(--rz-primary);
  background: #eff6ff;
}

.rail-group:hover > .rail-item:not(.active) {
  background: #f1f5f9;
  color: #334155;
}

/* Flyout submenu — hidden by default, shown on hover */
.rail-flyout {
  position: fixed;
  left: 56px;
  min-width: 200px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px 0;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}

.rail-group:hover .rail-flyout {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}

.rail-flyout-title {
  padding: 6px 14px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.04em;
}

.rail-flyout-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  color: #334155;
  cursor: pointer;
  transition: background 0.12s;
}

.rail-flyout-item:hover {
  background: #f1f5f9;
}

.rail-flyout-item.active {
  color: var(--rz-primary);
  font-weight: 600;
}

.rail-flyout-item .rzi { font-size: 1.05rem; }

.rail-tenant {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #e2e8f0;
  color: #94a3b8;
  flex-shrink: 0;
}

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

.app-header {
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.8rem;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-header-title {
  font-weight: 600;
  color: var(--rz-text-color);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-header-user {
  font-size: 0.78rem;
  color: var(--rz-text-secondary-color);
}

.rz-header-filter-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
}

.rz-header-filter-title {
  font-weight: 600;
  font-size: 0.8rem;
}

.rz-header-filter-cell .rz-dropdown {
  min-height: 28px !important;
}

.rz-header-filter-cell .rz-dropdown .rz-inputtext {
  padding: 0.2rem 0.4rem !important;
  font-size: 0.8rem !important;
}

.rz-datatable .rz-paginator,
.rz-datatable .rz-pager {
  min-height: 28px !important;
  padding: 0.2rem 0.5rem !important;
}

.rz-datatable .rz-paginator .rz-paginator-element,
.rz-datatable .rz-pager .rz-paginator-element {
  min-height: 24px !important;
  padding: 0.15rem 0.4rem !important;
  font-size: 0.8rem !important;
}

.rz-datatable .rz-paginator .rz-dropdown,
.rz-datatable .rz-pager .rz-dropdown {
  min-height: 24px !important;
}

.rz-datatable .rz-datatable-footer {
  min-height: 28px !important;
  padding: 0.2rem 0.5rem !important;
}

/* Body containers removed — replaced by app-shell layout */


.rz-body {
  background-color: #f6f7fb;
  padding-top: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Контейнер для страниц с full-height layout (чаты, коммуникации и др.) */
.body-full-height {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Контейнер контента по умолчанию */
.body-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.body-full-height .rz-tabview {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.body-full-height .rz-tabview-panels {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.body-full-height .rz-tabview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Compact Radzen tab headers for communication page */
.body-full-height .rz-tabview-nav {
  gap: 0 !important;
}

.body-full-height .rz-tabview-nav li .rz-tabview-nav-link {
  padding: 0.35rem 1rem !important;
  font-size: 0.82rem !important;
}

/* Общий стиль всех таблиц Radzen */
.rz-data-grid {
  border-radius: 6px;
  overflow: hidden;
  overflow-x: hidden !important;

  border: 1px solid #e9ecf8;
  box-shadow:
    0 16px 32px rgba(15, 23, 42, 0.10),
    0 3px 8px rgba(15, 23, 42, 0.05);
}

/* Убираем горизонтальный скроллбар внутри таблицы */
.rz-data-grid .rz-datatable-scrollable-wrapper {
  overflow-x: hidden !important;
}

.rz-data-grid .rz-datatable-scrollable-body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-width: none !important; /* Firefox */
}

.rz-data-grid .rz-datatable-scrollable-body::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Edge */
}

/* Hover строк */
.rz-data-row {
  border: 1px solid #eef1ff;
}

.rz-data-row:hover {
  background-color: #f2f5ff !important;
  transition: background-color 0.2s ease;
}

/* Заголовки */
.rz-data-grid th {
  vertical-align: bottom;
  background: var(--rz-base-200) !important;
}

/* Уменьшаем паддинги для всех ячеек таблицы */
.rz-grid-table td,
.rz-grid-table th {
  padding: 0.2rem 0.3rem !important;
}

.rz-data-grid th .rz-column-title-content,
.rz-data-grid th .rz-header-filter-title {
  font-size: 13px;
  color:var(--rz-base-dark) !important;
  font-weight: 600;
  letter-spacing: 0.1px;
}

.rz-grid-table{
  border-bottom: 1px solid #e7ebff;
  table-layout: fixed;
}

/* Prevent cell content from expanding columns */
.rz-grid-table td {
  overflow: clip;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

/* Отступы заголовков */
.rz-grid-table thead th > div:not(.rz-cell-filter) {
  padding: 8px 0;
}

/* Pager */
.rz-datatable .rz-pager.rz-unselectable-text {
  padding: 0.1rem 1.5rem 0.1rem 0.5rem  !important;
}

/* Ячейки текста */
.rz-data-grid .rz-cell-data p {
  margin: 0 ;
  line-height: 1.4 !important;
}

/* Иконка фильтра в таблице */
.rz-grid-filter-icon {
  margin: 0 !important;
}

.rz-grid-table thead th .rz-column-title {
  padding-left: 0.25rem !important;
}

/* Фильтр "Все" в шапке таблиц */
.filter-all-item{
  padding:8px 12px;
  cursor:pointer;
  border:1px solid #dcdcdc;
  border-bottom:none;
  border-radius:6px 6px 0 0;
  background:white;
}

.filter-all-item:hover{
  background:#f5f6ff;
}

.filter-all-item.active{
  background:#ececff;
  font-weight:500;
}

.rz-listbox{
  border-radius: 0 0 4px 4px;
}

/* Badge */
.status-badge {
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #4b5563;
  background: #ececff;
}

.rz-badge {
  text-transform: none !important;
}



/* Шапка таблицы*/
.compact-grid thead th > div {
  height: 28px;
  line-height: 28px;
  font-size: 0.85rem;
}

/* Кнопки со знаками арифметических действий */
.operator-button {
  padding: 0.5rem 0.75rem !important;
  background-color: white !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  color: var(--rz-base-darker) !important;
  font-weight: 600 !important;
  font-size: 0.8rem !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.16) !important;
  transition: transform 0.1s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

.operator-button:hover {
  border-color: var(--rz-primary) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
  transform: translateY(-1px) !important;
}

.my-popup {
  display: none;
  position: absolute;
  max-height: 300px;
  width: 220px;
  overflow: auto;
  padding: 16px;
  border: var(--rz-panel-border);
  background-color: var(--rz-panel-background-color);
  box-shadow: var(--rz-panel-shadow);
  border-radius: var(--rz-border-radius);
  z-index: 2000;
}

/* Radzen: по умолчанию z-index:1002 — тосты оказываются под модалкой доски (.task-detail-overlay 1100) и под лайтбоксом */
.rz-notification {
  z-index: 8000 !important;
}

/* шапка кастомных колонкох в таблице Транзакций  */
.header-bg-full {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  background-color: var(--rz-primary-light) !important;
  color: white !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  z-index: -1;
}

.q-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px 3px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    border: 2px solid transparent;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.q-pill:hover {
    opacity: 0.85;
}

.q-pill.active {
    border-color: currentColor;
}

.q-pill-count {
    font-size: 0.74rem;
    opacity: 0.6;
    font-weight: 400;
}

.dlg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.dlg-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--rz-base-300, #e0e0e0);
    border-top-color: var(--rz-primary, #3b82f6);
    border-radius: 50%;
    animation: dlg-spin 0.75s linear infinite;
}

@keyframes dlg-spin {
    to { transform: rotate(360deg); }
}

/* Коммуникации */
.rz-tabview-panel {
  padding: 0;
}
.tab-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column-reverse; }
  .icon-rail {
    width: 100%;
    height: 56px;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid #e2e8f0;
  }
  .rail-brand { display: none; }
  .rail-tenant { display: none; }
  .rail-items {
    flex-direction: row;
    justify-content: space-around;
    padding: 0;
    overflow-x: auto;
  }
  .rail-item { height: 56px; min-width: 56px; }
  .rail-flyout { display: none !important; }
}
