/* ============================================================
   СЛУЖБА ПО ОХРАНЕ И ИСПОЛЬЗОВАНИЮ ОБЪЕКТОВ ЖИВОТНОГО МИРА
   ИРКУТСКОЙ ОБЛАСТИ — Единая дизайн-система v1.0
   Полноэкранный режим, высокая читаемость для инспекторов,
   табличная архитектура Журнала и Отчётов
   ============================================================ */

:root {
  --green-950: #042f2e;
  --green-900: #064e3b;
  --green-800: #065f46;
  --green-700: #047857;
  --green-600: #059669;
  --green-500: #10b981;
  --green-100: #d1fae5;
  --green-50:  #ecfdf5;

  --blue-100:   #dbeafe;
  --blue-700:   #1d4ed8;
  --red-100:    #fee2e2;
  --red-700:    #b91c1c;
  --red:        #dc2626;
  --amber-100:  #fef3c7;
  --amber-800:  #92400e;
  --violet-100: #ede9fe;
  --violet-700: #6d28d9;
  --slate-100:  #f1f5f9;
  --slate-200:  #e2e8f0;
  --slate-600:  #475569;

  --bg:        #eef2f6;
  --card:      #ffffff;
  --text:      #0f172a;
  --muted:     #475569;
  --border:    #cbd5e1;
  --shadow:    0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .05);
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Верхняя государственная шапка ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  min-height: 62px;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 60%, var(--green-700) 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(6, 78, 59, .3);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  flex: none;
}
.brand .logo,
.brand img.logo {
  height: 44px;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.brand .brand-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .1px;
  max-width: 360px;
  -webkit-font-smoothing: subpixel-antialiased;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .22);
}
.brand .brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: #a7f3d0;
  letter-spacing: .3px;
}

.app-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.navbtn {
  color: #e2f8ee;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 8px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.navbtn:hover {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}
.navbtn.active {
  background: #ffffff;
  color: var(--green-900);
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  padding: 5px 14px 5px 7px;
  font-size: 13px;
  font-weight: 600;
  flex: none;
}
.user-chip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-600);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.btn-logout {
  background: rgba(255, 255, 255, .12);
  color: #fecaca;
  border: 1px solid rgba(255, 255, 255, .24);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: .15s;
  flex: none;
}
.btn-logout:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ---------- Полноэкранная рабочая область (без урезания по бокам) ---------- */
.app-main {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 16px 20px 28px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0 0 2px;
  font-size: 22px;
  font-weight: 800;
  color: var(--green-900);
}
.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}
.page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Карточки и панели ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}
.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-head span {
  color: var(--muted);
  font-size: 12px;
}
.panel-body { padding: 0; }

/* ---------- Базовые таблицы ---------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
table.grid {
  width: 100%;
  border-collapse: collapse;
}
table.grid thead th {
  background: #f8fafc;
  color: var(--text);
  text-align: left;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 11px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table.grid tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-200);
  font-size: 14px;
  vertical-align: middle;
}
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr { transition: background .1s; }
table.grid tbody tr:hover { background: var(--green-50); }
table.grid button {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
  transition: .15s;
}
table.grid button:hover {
  background: var(--green-100);
  border-color: var(--green-600);
}
table.grid button[data-del]:hover {
  background: var(--red-100);
  border-color: var(--red);
}

.icon-btn {
  position: relative;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
  transition: .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.icon-btn:hover { background: rgba(255, 255, 255, .22); }
.modal .icon-btn,
table.grid .icon-btn {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text);
}
.modal .icon-btn:hover,
table.grid .icon-btn:hover {
  background: var(--red-100);
  border-color: var(--red);
  color: var(--red-700);
}
.icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 17px;
  text-align: center;
}

.act-btn {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: .15s;
}
.act-btn:hover {
  background: var(--green-100);
  border-color: var(--green-600);
}
.act-btn[data-del]:hover {
  background: var(--red-100);
  border-color: var(--red);
}

.cell-strong { font-weight: 700; }
.cell-muted, .muted { color: var(--muted); }

/* ---------- Бейджи, статусы и ролевые теги ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-issued      { background: var(--green-100); color: var(--green-800); }
.badge-application { background: var(--amber-100); color: var(--amber-800); }
.badge-refused     { background: var(--red-100);   color: var(--red-700); }
.badge-deleted     { background: #64748b;          color: #fff; }
.badge-issues      { background: #b45309;          color: #fff; margin-left: 4px; }

.role-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.rt-admin     { background: var(--violet-100); color: var(--violet-700); }
.rt-head      { background: var(--blue-100);   color: var(--blue-700); }
.rt-inspector { background: var(--green-100);  color: var(--green-800); }
.rt-viewer    { background: var(--slate-100);  color: var(--slate-600); }

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--slate-100);
  color: var(--slate-600);
  font-size: 11.5px;
  font-weight: 700;
}

/* ---------- Чипы и кнопки ---------- */
.chips {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: .15s;
}
.chip:hover {
  border-color: var(--green-600);
  color: var(--green-800);
  background: var(--green-50);
}
.chip.active {
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 6px rgba(4, 120, 87, .28);
}
.chip.active.c-application { background: linear-gradient(135deg, #b45309, #f59e0b); }
.chip.active.c-refused     { background: linear-gradient(135deg, var(--red-700), #ef4444); }

.btn, .btn-primary, button.primary, .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(4, 120, 87, .28);
  transition: .15s;
  text-decoration: none;
}
.btn-primary:hover, button.primary:hover, .primary:hover, .btn:hover {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  box-shadow: 0 4px 12px rgba(4, 120, 87, .38);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  transition: .15s;
  text-decoration: none;
}
.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.btn-ghost {
  background: #fff;
  border: 1.5px dashed var(--green-600);
  color: var(--green-800);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: .15s;
}
.btn-ghost:hover { background: var(--green-50); }

/* ---------- Поля ввода и формы ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
input, select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px var(--green-100);
}
.addrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
}
.addrow input, .addrow select { min-width: 190px; background: #fff; }

#districts-box {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
#districts-box label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  cursor: pointer;
  background: #fff;
  transition: .15s;
  font-size: 13px;
}
#districts-box label:hover {
  border-color: var(--green-600);
  background: var(--green-50);
}
#districts-box input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--green-700);
}

/* ---------- Табы и панель поиска ---------- */
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 800;
  transition: .15s;
}
.tab:hover { background: var(--green-50); color: var(--green-800); }
.tab.active {
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
  color: #fff;
  box-shadow: 0 2px 8px rgba(4, 120, 87, .28);
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.search-wrap .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background: #f8fafc;
}
.search-wrap input:focus { background: #fff; }
.filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 14px;
}

/* ---------- Модальные окна ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, .58);
  
  overflow-y: auto;
  padding: 24px 16px;
}
.overlay.hidden { display: none; }
.modal {
  background: #fff;
  max-width: 1060px;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .32);
  animation: slideUp .18s ease-out;
  overflow: hidden;
}
.modal-small { max-width: 520px; }
.modal-large { max-width: 920px; }
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
}
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-close {
  margin-left: auto;
  background: rgba(255, 255, 255, .14);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--red); color: #fff; }

.modal-body {
  padding: 20px 24px;
  max-height: 76vh;
  overflow-y: auto;
}
.modal fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 0 16px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  background: #fcfdfe;
}
.modal fieldset.wide { display: block; }
.modal fieldset legend {
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--green-800);
  padding: 0 8px;
  cursor: pointer;
}
.modal fieldset legend::after { content: ' ▾'; font-size: 11px; color: var(--muted); }
.modal fieldset.collapsed legend::after { content: ' ▸'; }
.modal fieldset.collapsed > *:not(legend) { display: none; }

.modal label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 700;
  min-width: 0;
}
.modal input, .modal select, .modal textarea {
  width: 100%;
  min-width: 0;
  background: #fff;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

.issues-banner {
  margin: 14px 24px 0;
  padding: 12px 16px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  color: #78350f;
  font-size: 13px;
}
.issues-banner h4 { margin: 0 0 6px; font-size: 14px; color: #92400e; }
.issues-banner ul { margin: 4px 0 10px 18px; padding: 0; }
.btn-confirm-fix {
  background: #047857;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.btn-confirm-fix:hover { background: #065f46; }

/* ---------- ЖУРНАЛ РАЗРЕШЕНИЙ (Эксель-сетка во весь экран) ---------- */
.table-scroll {
  width: 100%;
  /* Высота во весь экран под шапкой: горизонтальный ползунок всегда внизу экрана! */
  max-height: calc(100vh - 78px);
  min-height: 420px;
  overflow: auto;
  position: relative;
}
/* Крупные заметные ползунки прокрутки для удобства инспекторов */
.table-scroll::-webkit-scrollbar {
  height: 14px;
  width: 14px;
}
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--green-700);
  border-radius: 7px;
  border: 2px solid #e2e8f0;
}
.table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--green-900);
}
.table-scroll::-webkit-scrollbar-track {
  background: #e2e8f0;
}

.journal-grid {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

/* Шапка таблицы Журнала */
.app-main .card table.journal-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--green-700);
  color: #fff;
  font-size: 11.5px;
  line-height: 1.25;
  font-weight: 700;
  padding: 7px 9px;
  border-right: 1px solid rgba(255, 255, 255, .2);
  border-bottom: 1px solid rgba(255, 255, 255, .28);
  cursor: pointer;
  user-select: none;
  white-space: normal;
  min-width: 82px;
  vertical-align: middle;
}
.app-main .card table.journal-grid thead tr:first-child th { height: 44px; }
.app-main .card table.journal-grid thead tr:nth-child(2) th {
  top: 44px;
  height: 30px;
  white-space: nowrap;
}
.app-main .card table.journal-grid thead th.th-group {
  background: var(--green-800);
  color: #e7f6ee;
  text-align: center;
}
.app-main .card table.journal-grid thead th:hover {
  background: var(--green-600);
}
.app-main .card table.journal-grid thead th.sorted-asc,
.app-main .card table.journal-grid thead th.sorted-desc {
  color: #fed7aa;
}
.app-main .card table.journal-grid thead th.sorted-asc::after  { content: ' ▲'; font-size: 9px; }
.app-main .card table.journal-grid thead th.sorted-desc::after { content: ' ▼'; font-size: 9px; }

/* Тело таблицы Журнала — чёткая сетка в стиле Excel */
.app-main .card table.journal-grid tbody td {
  padding: 6px 9px;
  font-size: 13.5px;
  white-space: nowrap;
  vertical-align: top;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
.app-main .card table.journal-grid tbody td:empty::after { content: '\00a0'; }

/* Липкие (замороженные слева) колонки без наложения друг на друга */
.app-main .card table.journal-grid .col-check {
  position: sticky !important;
  left: 0 !important;
  z-index: 3 !important;
  width: 40px !important;
  min-width: 40px !important;
  text-align: center;
}
.app-main .card table.journal-grid thead .col-check {
  z-index: 5 !important;
  background: var(--green-800) !important;
}
.app-main .card table.journal-grid .col-num {
  position: sticky !important;
  left: 40px !important;
  z-index: 3 !important;
  min-width: 58px;
  text-align: center;
  white-space: nowrap;
}
.app-main .card table.journal-grid thead .col-num {
  z-index: 5 !important;
  background: var(--green-800) !important;
}
.app-main .card table.journal-grid tbody .col-num {
  font-weight: 700;
  color: var(--slate-600);
  box-shadow: 2px 0 4px rgba(15, 23, 42, .06);
}

.app-main .card table.journal-grid .col-status {
  min-width: 92px;
}
.app-main .card table.journal-grid thead .col-status {
  position: sticky;
  top: 0;
  z-index: 2;
}
.app-main .card table.journal-grid td.col-status .badge {
  display: block;
  width: max-content;
  margin: 1px 0;
  color: #fff;
  font-size: 10.5px;
  padding: 2px 7px;
}
.app-main .card table.journal-grid .badge-issued      { background: var(--green-600); }
.app-main .card table.journal-grid .badge-application { background: #f59e0b; }
.app-main .card table.journal-grid .badge-refused     { background: var(--red); }

/* Номер заявления и ФИО прилипают с учётом 40px колонки чекбокса */
.app-main .card table.journal-grid .col-appnum {
  position: sticky;
  left: calc(40px + var(--num-w, 58px));
  z-index: 3;
  min-width: 140px;
  font-weight: 700;
}
.app-main .card table.journal-grid thead .col-appnum {
  z-index: 4;
  background: var(--green-800);
}
.app-main .card table.journal-grid tbody .col-appnum {
  box-shadow: 2px 0 4px rgba(15, 23, 42, .06);
}

.app-main .card table.journal-grid .col-fio {
  position: sticky;
  left: calc(40px + var(--fio-left, 200px));
  z-index: 3;
  min-width: 190px;
}
.app-main .card table.journal-grid thead .col-fio {
  z-index: 4;
  background: var(--green-800);
}
.app-main .card table.journal-grid tbody .col-fio {
  box-shadow: 3px 0 6px rgba(15, 23, 42, .08);
}

/* Статусные полоски слева на колонке номера */
.app-main .card table.journal-grid tbody tr.row-issued .col-num      { box-shadow: inset 3px 0 0 var(--green-600), 2px 0 4px rgba(15,23,42,.06); }
.app-main .card table.journal-grid tbody tr.row-application .col-num { box-shadow: inset 3px 0 0 #f59e0b, 2px 0 4px rgba(15,23,42,.06); }
.app-main .card table.journal-grid tbody tr.row-refused .col-num     { box-shadow: inset 3px 0 0 var(--red), 2px 0 4px rgba(15,23,42,.06); }

/* Интерактивные состояния строк: наведение, курсор, выбор чекбоксом, ошибки */
.app-main .card table.journal-grid tbody tr:hover td {
  background: #ffedd5 !important;
}
.app-main .card table.journal-grid tbody tr.row-cursor td {
  background: #ecfdf5;
}
.app-main .card table.journal-grid tbody tr.row-cursor td:first-child {
  box-shadow: inset 4px 0 0 var(--green-800);
}
.app-main .card table.journal-grid tbody tr.row-selected td {
  background: #fed7aa !important;
  color: #7c2d12;
}
.app-main .card table.journal-grid tbody tr.row-issues td {
  background: #fef3c7 !important;
}
.app-main .card table.journal-grid tbody tr.row-issues:hover td,
.app-main .card table.journal-grid tbody tr.row-issues.row-cursor td {
  background: #fde68a !important;
}
.app-main .card table.journal-grid tbody td.cell-bad {
  background: #fee2e2 !important;
  color: #991b1b !important;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px #dc2626;
  cursor: help;
}

/* Удалённые (перечёркнутые) строки */
.app-main .card table.journal-grid tbody tr.row-deleted td:not(.col-status) {
  text-decoration: line-through;
  color: #94a3b8;
}

/* Чекбокс выбора строки без скачков размера */
.app-main .card table.journal-grid input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  transform: none !important;
  animation: none !important;
  transition: none !important;
  cursor: pointer;
  accent-color: var(--green-700);
}

/* Подсветка найденного в поиске */
.journal-grid mark, mark.search-hit {
  background: #fde047;
  color: #713f12;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 800;
}

.cell-dup {
  background: #fef9c3;
  border-bottom: 1px dashed #f59e0b;
  border-radius: 4px;
  padding: 0 4px;
  cursor: help;
}

.status-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.status-legend .sl-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status-legend .sl-dot  { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.status-legend .sl-issued      { background: var(--green-600); }
.status-legend .sl-application { background: #f59e0b; }
.status-legend .sl-refused     { background: var(--red); }

/* ---------- Двухколоночный выбор угодий и автоподстановка охотника ---------- */
.areas-dual {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}
.areas-col { display: flex; flex-direction: column; gap: 6px; }
.areas-title { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.areas-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  max-height: 200px;
  overflow: auto;
  padding: 6px;
}
.areas-item {
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  cursor: pointer;
}
.areas-item:hover { background: #ffedd5; }
.areas-item.chosen { background: var(--green-50); font-weight: 700; color: var(--green-900); }
.areas-item.chosen:hover { background: #fee2e2; color: #991b1b; }
.areas-empty { padding: 12px; font-size: 12.5px; color: var(--muted); text-align: center; }
.areas-mid { display: flex; flex-direction: column; gap: 8px; justify-content: center; }

.harv-hint { font-size: 11px; color: var(--muted); margin-top: 2px; }

#hunter-suggest {
  display: none;
  position: fixed;
  z-index: 250;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .22);
  overflow: hidden;
}
#hunter-suggest .hs-item { padding: 9px 12px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid #f1f5f9; }
#hunter-suggest .hs-item:hover { background: #ffedd5; }
#hunter-suggest .hs-item span { display: block; font-size: 11.5px; color: var(--muted); }
#hunter-suggest .hs-note { padding: 6px 12px; font-size: 11px; color: var(--green-800); background: var(--green-50); font-weight: 600; }

/* ---------- Дашборд, KPI, Аудит, Импорт ---------- */
.kpi-row, .stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.kpi, .stat-card {
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  color: #fff;
  box-shadow: var(--shadow);
}
.kpi .label, .stat-card .l { font-size: 12px; opacity: .9; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.kpi .value, .stat-card .v { font-size: 30px; font-weight: 800; margin-top: 6px; }
.kpi .sub { font-size: 12px; opacity: .85; margin-top: 4px; }
.kpi-green, .sc-green { background: linear-gradient(135deg, var(--green-800), var(--green-600)); }
.kpi-blue,  .sc-blue  { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.kpi-amber, .sc-amber { background: linear-gradient(135deg, #b45309, #f59e0b); }
.sc-red               { background: linear-gradient(135deg, var(--red-700), #ef4444); }

.pulse { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding: 6px 2px; }
.pulse .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.pulse .bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, var(--green-600), var(--green-700)); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.pulse .bar.today { background: linear-gradient(180deg, #3b82f6, #1d4ed8); }
.pulse .num { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.pulse .day { font-size: 10px; color: var(--muted); margin-top: 5px; }

.top-row { margin-bottom: 12px; }
.top-row .t { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar-track { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green-600), var(--green-700)); }
.bar-fill.blue   { background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.bar-fill.violet { background: linear-gradient(90deg, #8b5cf6, #6d28d9); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { display: block; text-decoration: none; color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 14px; text-align: center; box-shadow: var(--shadow); transition: .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--green-600); }
.tile .em { font-size: 26px; }
.tile .tt { font-weight: 700; margin-top: 8px; font-size: 13px; }
.tile .dd { color: var(--muted); font-size: 11px; margin-top: 3px; }

.log-item { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.log-item:last-child { border-bottom: none; }
.log-item:hover { background: var(--green-50); }
.dot { width: 38px; height: 38px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.d-create, .b-create { background: var(--green-100); color: var(--green-800); }
.d-update, .b-update { background: var(--blue-100);  color: var(--blue-700); }
.d-delete, .b-delete, .d-fail, .b-fail { background: var(--red-100); color: var(--red-700); }
.d-return, .b-return { background: var(--amber-100); color: var(--amber-800); }
.d-auth,   .b-auth   { background: var(--slate-100); color: var(--slate-600); }

/* Статусы предпросмотра Импорта Excel */
.stat-ok    { background: var(--green-100); color: var(--green-800); padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.stat-dup   { background: var(--amber-100); color: var(--amber-800); padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.stat-error { background: var(--red-100);   color: var(--red-700);   padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.verdict { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.verdict.ok        { background: var(--green-100); color: var(--green-800); }
.verdict.warn      { background: var(--amber-100); color: var(--amber-800); }
.verdict.duplicate { background: var(--red-100);   color: var(--red-700); }

/* ---------- Уведомления (Тосты), ФАБ, Загрузка ---------- */
.fab-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--green-700);
  color: #fff;
  font-size: 21px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  z-index: 90;
}
.fab-btn:hover { background: var(--green-600); }

.toast-container {
  position: fixed;
  right: 24px;
  bottom: 88px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 260;
}
.toast {
  min-width: 260px;
  max-width: 400px;
  background: #fff;
  border-left: 5px solid var(--green-600);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 700;
  animation: toastIn .22s ease-out;
}
.toast.error { border-left-color: #dc2626; }
.toast.warn  { border-left-color: #d97706; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.table-count { font-size: 13px; color: var(--muted); font-weight: 700; }
.table-empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; color: var(--muted); gap: 12px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--green-600); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty, .denied { padding: 50px 20px; text-align: center; color: var(--muted); font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }

@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .app-header { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .app-header nav { order: 3; width: 100%; overflow-x: auto; margin-left: 0; }
  .modal fieldset { grid-template-columns: 1fr; }
  .brand .brand-title { max-width: none; }
}

@media print {
  body { background: #fff; font-size: 12px; }
  .app-header, .toolbar, .filters, .tabs, .chips, .btn, .btn-primary,
  .btn-secondary, .btn-ghost, .page-actions, .no-print, .fab-btn { display: none !important; }
  .app-main { max-width: none; padding: 0; }
  .card, .panel { border: none; box-shadow: none; border-radius: 0; }
  table.grid thead th, table.grid tbody td { border: 1px solid #000; padding: 6px 8px; }
  tr { page-break-inside: avoid; }
}


.modal-head h2 { font-weight: 500 !important; }
.no-harvest-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px dashed #f59e0b;
  border-radius: 4px;
}

@keyframes ohota-spin { to { transform: rotate(360deg); } }
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid #cbd5e1;
  border-top-color: #16a34a;
  border-radius: 50%;
  animation: ohota-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
