*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Auth Page Body ────────────────────────────────────────────────────────── */

body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header-title { flex: 1; }

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#sidebar-toggle { display: none; }

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.page-body {
  padding: 24px;
  flex: 1;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */

/* Logo row: logo link + notification bell side by side */
.sidebar-logo-wrap {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--sidebar-border);
  position: relative; /* anchor for dropdown */
}

.sidebar-logo {
  flex: 1;
  min-width: 0;
  padding: 20px 6px 16px 16px; /* reduced right padding — button sits next */
  border-bottom: none;          /* border moved to wrapper */
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

/* Notification bell button in the logo row */
.sidebar-notif-btn {
  flex-shrink: 0;
  margin-right: 10px;
  color: var(--sidebar-text) !important;
  opacity: 0.55;
  transition: opacity var(--transition);
  position: relative; /* for badge positioning */
}
.sidebar-notif-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08) !important; /* subtle dark-sidebar hover */
}

/* Badge over bell icon — top-right corner overlay */
.sidebar-notif-btn .nav-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  margin: 0;
  min-width: 15px;
  height: 15px;
  font-size: 9px;
  padding: 0 3px;
  line-height: 15px;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.sidebar-company {
  padding: 12px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-company-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text);
  opacity: 0.5;
  margin-bottom: 4px;
}

.sidebar-company-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 8px;
  overflow-y: auto;
}

.nav-group-label {
  padding: 12px 8px 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-text);
  opacity: 0.4;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg,
.nav-item:hover svg {
  opacity: 1;
}

.nav-badge {
  display: none;
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  min-width: 18px;
  text-align: center;
}
.nav-badge.nav-badge-active {
  display: inline-block;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-600);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.sidebar-username {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sidebar-text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Stat Cards ────────────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

a.stat-card-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
a.stat-card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-500);
}

/* ── Act upload highlight ─────────────────────────────────────────────────── */
.btn-act-missing {
  background: var(--warning) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600 !important;
  animation: actPulse 2.5s ease-in-out infinite;
}
.btn-act-missing:hover {
  background: #D97706 !important;
  animation: none;
}
@keyframes actPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .45); }
  50%       { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); }
}

/* ── Tables ────────────────────────────────────────────────────────────────── */

.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--transition);
  cursor: default;
}

.data-table tbody tr:hover { background: var(--bg-muted); }

.data-table tbody tr.clickable { cursor: pointer; }

/* ── Badges / Status ────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Solid colored badges — maximum readability on any background */
.badge-success   { background: #059669; color: #fff; }
.badge-warning   { background: #D97706; color: #fff; }
.badge-danger    { background: #DC2626; color: #fff; }
.badge-info      { background: #2563EB; color: #fff; }
.badge-gray      { background: #6B7280; color: #fff; }
.badge-primary   { background: #5f3968; color: #fff; }
.badge-primary-act   { background: #059669; color: #fff; }
.badge-secondary { background: #64748B; color: #fff; }

/* Equipment status badges */
.status-storage     { background: #2563EB; color: #fff; }   /* Синий     — На складе  */
.status-assigned    { background: #059669; color: #fff; }   /* Зелёный   — Выдано     */
.status-written_off { background: #B45309; color: #fff; }   /* Янтарный  — Списано    */
.status-purchased   { background: #7C3AED; color: #fff; }   /* Фиолетов. — Выкуплено  */
.status-repair      { background: #EA580C; color: #fff; }   /* Оранжев.  — В ремонте  */
.status-deleted     { background: #6B7280; color: #fff; }   /* Серый     — Удалено    */

/* Employee status */
.status-active    { background: #059669; color: #fff; }    /* Зелёный — Работает */
.status-dismissed { background: #B45309; color: #fff; }    /* Янтарный — Уволен  */

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; }

.btn-primary {
  background: #863c98;
  color: #fff;
  border-color: #863c98;
}
.btn-primary:hover { background: #ad36ca38; border-color: #9b2db9; color: #fff; }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-muted); color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #DC2626; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 11px 22px; font-size: 1rem; }

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-md);
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-control::placeholder { color: var(--text-muted); }

.form-control.is-invalid { border-color: var(--danger); }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* ── Search Bar ─────────────────────────────────────────────────────────────── */

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

/* ── Filters Row ───────────────────────────────────────────────────────────── */

.filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* ── Flash Messages ─────────────────────────────────────────────────────────── */

.flash-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  pointer-events: none;
}

.flash-msg {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: all;
  animation: slideIn .2s ease;
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.flash-success { background: var(--success-bg); color: #065F46; border: 1px solid #A7F3D0; }
.flash-error   { background: var(--danger-bg);  color: #991B1B; border: 1px solid #FECACA; }
.flash-warning { background: var(--warning-bg); color: #92400E; border: 1px solid #FDE68A; }
.flash-info    { background: var(--info-bg);    color: #1E40AF; border: 1px solid #BFDBFE; }

.flash-close {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.6;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  line-height: 1;
}
.flash-close:hover { opacity: 1; }

/* ── Modals ────────────────────────────────────────────────────────────────── */

/* JS/CSS show-hide: add modal-hidden to hide, remove to show */
.modal-hidden { display: none !important; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-body { padding: 20px 24px; }

/* Form variant — flex column layout for quick-assign style modals */
.modal-body-form {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Pagination ─────────────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  justify-content: center;
}

.page-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: all var(--transition);
  cursor: pointer;
}

.page-item:hover { background: var(--bg-muted); }
.page-item.active { background: var(--primary-600); color: #fff; border-color: var(--primary-600); }
.page-item.disabled { color: var(--text-muted); pointer-events: none; }

/* ── Empty State ────────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  margin: 0 auto 16px;
  opacity: 0.3;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 0.875rem;
  margin-bottom: 24px;
}

/* ── Timeline ───────────────────────────────────────────────────────────────── */

.timeline { position: relative; padding-left: 28px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item { position: relative; margin-bottom: 20px; }

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-500);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 2px var(--primary-200);
}

.timeline-dot.returned  { background: var(--success); box-shadow: 0 0 0 2px #A7F3D0; }
.timeline-dot.purchased { background: var(--info);    box-shadow: 0 0 0 2px #BFDBFE; }
.timeline-dot.written_off { background: var(--danger); box-shadow: 0 0 0 2px #FECACA; }

.timeline-date { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.timeline-text { font-size: 0.875rem; color: var(--text-primary); }

/* ── Depreciation Bar ──────────────────────────────────────────────────────── */

.dep-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dep-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.dep-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary-500);
  transition: width .4s ease;
}

.dep-bar-fill.warn  { background: var(--warning); }
.dep-bar-fill.crit  { background: var(--danger); }

/* ── Gallery Grid ───────────────────────────────────────────────────────────── */

.img-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.img-thumb-wrap {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.img-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .2s ease;
}

.img-thumb-wrap:hover img { transform: scale(1.05); }

.img-thumb-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 3px 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition);
}

.img-thumb-wrap:hover .img-thumb-delete { opacity: 1; }

/* ── Image Lightbox ─────────────────────────────────────────────────────────── */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  object-fit: contain;
  box-shadow: var(--shadow-lg);
}

/* ── QR Code ────────────────────────────────────────────────────────────────── */

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.qr-wrap img {
  border: 8px solid #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ── Alerts / Warnings ──────────────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.alert-warning { background: #FFFBEB; color: #78350F; border: 1px solid #FCD34D; border-left: 3px solid var(--warning); }
.alert-danger  { background: var(--danger-bg);  color: #991B1B; border: 1px solid #FECACA; border-left: 3px solid var(--danger); }
.alert-info    { background: var(--info-bg);    color: #1E40AF; border: 1px solid #BFDBFE; border-left: 3px solid var(--info); }

/* Minimalist notice style (brand-aligned, less alarming than amber warning) */
.alert-notice {
    background: #c0183f;
    color: #ffffff;
    border: 1px solid #ffffff;
    font-weight: 700;
}

/* Alert link — right-aligned action inside alert */
.alert-link {
  margin-left: auto;
  color: inherit;
  font-weight: 600;
  font-size: .8rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.alert-link:hover { text-decoration: underline; }
/* Soft deleted-state banner — pale rose with muted text */
.alert-deleted {
  background: #FFF5F5;
  color: #7F1D1D;
  border: 1px solid #FECACA;
  border-left: 4px solid #F87171;
}

/* ── Utilities ──────────────────────────────────────────────────────────────── */

.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger    { color: var(--danger); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-info      { color: var(--info); }
.text-primary-c { color: var(--primary-600); }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.w-full { width: 100%; }

/* ── Logo Icon ──────────────────────────────────────────────────────────────── */

.sidebar-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Admin Layout Utilities ──────────────────────────────────────────────────── */

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--primary);
  flex-shrink: 0;
}

.user-row { display: flex; align-items: center; gap: 8px; }
.user-name { font-weight: 500; }
.text-muted-sm { font-size: 13px; color: var(--text-muted); }
.text-muted-xs { font-size: 12px; color: var(--text-muted); }

.badge-sm { font-size: 10px; }

.icon-muted {
  color: var(--text-muted);
  vertical-align: -1px;
}

.icon-success {
  color: var(--success);
  vertical-align: -1px;
}

.icon-warning {
  color: var(--warning);
  vertical-align: -1px;
}

.icon-align-baseline {
  vertical-align: -1px;
}

.icon-badge {
  display: inline;
  vertical-align: -2px;
  margin-right: 4px;
}

.no-margin {
  margin: 0;
}

.empty-state-margin {
  margin-top: 80px;
}

.btn-margin-top {
  margin-top: 16px;
}

.auto-number-label {
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.empty-state-padding {
  padding: 80px 0;
}

.equipment-form-wrap {
  max-width: 760px;
}

/* ── Card Layouts ───────────────────────────────────────────────────────────── */

.card-compact { max-width: 480px; }

.flex-gap-1 { display: flex; gap: 8px; }
.flex-gap-2 { display: flex; gap: 16px; }
.flex-gap-4 { display: flex; gap: 32px; }

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.form-actions-compact {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-full {
  grid-column: 1 / -1;
}

.form-control-auto {
  width: auto;
}

.card-wide {
  max-width: 600px;
}

.alert-mb {
  margin-bottom: 16px;
}

.pagination-meta {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.filters-margin {
  margin-bottom: 16px;
}

.font-weight-600 {
  font-weight: 600;
}

/* ── Select Company Grid ────────────────────────────────────────────────────── */

.company-select-grid {
  display: grid;
  gap: 12px;
}

.company-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color var(--transition);
  border: 1px solid var(--border);
  text-decoration: none;
}

.company-card:hover {
  border-color: var(--primary);
}

.company-card-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-soft);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.company-card-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.company-card-text {
  min-width: 0;
  flex: 1;
}

.company-card-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.company-card-role {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.company-select-width { max-width: 640px; }
.company-select-desc { color: var(--text-muted); margin-bottom: 24px; }

.audit-session-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0 46px;
}

/* ── Auth Page Layouts ──────────────────────────────────────────────────────── */

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-card-wide {
  max-width: 380px;
}

.auth-card-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-card-emoji {
  font-size: 3rem;
  margin-bottom: 16px;
}

.auth-card-emoji-sm {
  font-size: 2rem;
  margin-bottom: 8px;
}

.auth-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-card-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

.auth-card-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 24px;
}

.auth-turnstile {
  margin-bottom: 16px;
}

.auth-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 0.8rem;
}

.auth-footer-link {
  color: var(--primary-600);
  text-decoration: none;
}

.auth-footer-link:hover {
  text-decoration: underline;
}

.auth-bottom {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Error Page Styles ──────────────────────────────────────────────────────── */

body.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}

.error-code {
  font-size: 5rem;
  font-weight: 700;
  color: var(--gray-200);
  line-height: 1;
}

.error-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 16px 0 8px;
}

.error-message {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.error-details {
  text-align: left;
  background: var(--bg-muted);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  overflow: auto;
  max-width: 600px;
}

.error-banned-icon {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 16px;
}

.error-banned-message {
  color: var(--text-secondary);
}

.error-banned-ip {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  #sidebar-toggle { display: flex; }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-body {
    padding: 16px;
  }

  .filters-row {
    flex-wrap: wrap;
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-hero-card {
    flex-wrap: wrap;
  }
}

@media print {
  .sidebar, .page-header, .flash-container { display: none !important; }
  .main-content { margin-left: 0; }
  .page-body { padding: 0; }

  /* Print QR code only — use visibility so nested children can override */
  body.print-qr-only * { visibility: hidden; }
  body.print-qr-only .qr-print-container,
  body.print-qr-only .qr-print-container * { visibility: visible; }
  body.print-qr-only .qr-print-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    page-break-inside: avoid;
  }
  body.print-qr-only .qr-print-container .qr-wrap { margin: 0; }
}

/* ── Sidebar Footer Actions ─────────────────────────────────────────────────── */

.sidebar-footer-actions {
  padding: 4px 8px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-footer-btn { color: var(--sidebar-text) !important; }

/* ── Auth Pages ─────────────────────────────────────────────────────────────── */

body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-logo { text-align: center; margin-bottom: 28px; }

.auth-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-600);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.auth-title { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.auth-sub   { font-size: 0.875rem; color: var(--text-secondary); }

/* ── Notification Dropdown ──────────────────────────────────────────────────── */

.notif-hidden { display: none !important; }

.notif-dropdown {
  position: absolute;
  top: calc(100% + 4px); /* opens directly below the logo row */
  left: 0;
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 400; /* above sidebar content */
  overflow: hidden;
}

.notif-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.notif-header-title { font-size: 0.875rem; font-weight: 600; flex: 1; }

/* Right-side action buttons in notif header */
.notif-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.notif-mark-read {
  font-size: 0.85rem;
  color: bisque;
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background var(--transition);
}

.notif-mark-read:hover {
  background: #863c98;
  color: white;
}

/* Trash icon button — delete all */
.notif-delete-all-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
.notif-delete-all-btn:hover { color: white; background: #EF4444 }

.notif-body { max-height: 300px; overflow-y: auto; }

.notif-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-muted); }
.notif-item-unread { background: #332e16; border-left: 2px solid #ded23c; }
.notif-item-unread:hover { background: #817538; }

.notif-item-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-top: 1px;
}
.notif-item-unread .notif-item-icon {
  background: #4F46E5;
  color: #fff;
}
.notif-item-unread .notif-item-msg { color: var(--text-primary); font-weight: 500; }

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-msg  { font-size: 0.8rem; color: var(--text-primary); margin-bottom: 2px; line-height: 1.4; }
.notif-item-time { font-size: 0.72rem; color: #dce1e8; }

.notif-item-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Legacy class aliases (kept for backward compat) */
.notif-msg  { font-size: 0.8rem; color: var(--text-primary); margin-bottom: 2px; }
.notif-time { font-size: 0.75rem; color: var(--text-muted); }

/* ── Autocomplete ───────────────────────────────────────────────────────────── */

.autocomplete-list {
  display: none; /* shown via JS: list.style.display = 'block' */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 4px;
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg-surface);
}

.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg-muted); }
.autocomplete-name { font-weight: 500; }
.autocomplete-sub  { color: var(--text-muted); }

/* ── Confirm Modal ──────────────────────────────────────────────────────────── */

#confirm-modal { z-index: 9999; }

.confirm-modal-box { max-width: 420px; }

.confirm-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.confirm-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.confirm-modal-icon.danger { background: var(--danger-bg); }
.confirm-modal-icon.info   { background: var(--info-bg); }

.confirm-modal-body { flex: 1; min-width: 0; }
.confirm-modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; line-height: 1.3; }
.confirm-modal-message { margin: 0; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
.confirm-modal-footer { padding: 16px 24px 20px; }

.icon-danger { color: var(--danger); }
.icon-info   { color: var(--info); }

/* ── Drop Zone ──────────────────────────────────────────────────────────────── */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

/* ── Spec Row ───────────────────────────────────────────────────────────────── */

.spec-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}

/* ── Bulk Action Bar ────────────────────────────────────────────────────────── */

.bulk-bar {
  display: none; /* JS: style.display='flex' when rows selected */
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

.bulk-count {
  font-size: .82rem;
  font-weight: 600;
  padding: 0 4px;
  color: var(--text-secondary);
}

.bulk-bar-sep { width: 1px; height: 18px; background: var(--border); }

/* ── Filter Button ──────────────────────────────────────────────────────────── */

.filter-btn.active {
  background: var(--primary-600);
  color: #fff;
  border-color: var(--primary-600);
}

/* ── Tab Navigation ─────────────────────────────────────────────────────────── */

.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

.tab-btn {
  padding: 12px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition);
}

.tab-btn.active { color: var(--primary-600); border-bottom-color: var(--primary-600); }
.tab-btn:hover:not(.active) { color: var(--text-primary); }

.tab-content { display: none; padding: 20px; }
.tab-content.active { display: block; }

/* ── Timeline (detail pages) ────────────────────────────────────────────────── */

.dot-active   { background: #059669; }
.dot-returned { background: var(--gray-300); }
.dot-lifecycle { background: var(--primary-50); border-color: var(--primary-500) !important; }

.timeline-content {
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

/* ── Depreciation Bar (detail page) ─────────────────────────────────────────── */

.depreciation-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
}

.depreciation-fill { height: 100%; background: var(--warning); border-radius: 2px; }

/* ── Card Section Title ─────────────────────────────────────────────────────── */

.card-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Signed Act Download Button ─────────────────────────────────────────────── */

.btn-act-signed {
  background: #059669;
  color: #fff;
  border: none;
}

.btn-act-signed:hover { background: #047857; color: #fff; }

/* ── Detail Page Hero Card ──────────────────────────────────────────────────── */

.detail-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-hero-info { flex: 1; min-width: 0; }

.detail-hero-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 8px;
}

.detail-hero-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.detail-hero-meta { font-size: 0.85rem; color: var(--text-muted); }

.detail-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Detail Two-Column Layout ───────────────────────────────────────────────── */

.detail-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

/* ── Info DL ────────────────────────────────────────────────────────────────── */

.info-dl { display: grid; gap: 12px; }
.info-dt { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.info-dd { font-weight: 500; }

/* ── Mini Stat Boxes ────────────────────────────────────────────────────────── */

.stat-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.stat-mini {
  text-align: center;
  padding: 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}

.stat-mini-value { font-size: 28px; font-weight: 700; color: var(--primary-500); }
.stat-mini-label { font-size: 12px; color: var(--text-muted); }

/* ── Action Row ─────────────────────────────────────────────────────────────── */

.action-row {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Utilities ──────────────────────────────────────────────────────────────── */

.flex-wrap { flex-wrap: wrap; }
.font-mono { font-family: 'Courier New', Courier, monospace; }
.hint-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-group-0 { margin: 0; }
.text-link { color: #93e524; text-decoration: none; font-weight: 500; }
.text-link:hover { color: #dde792; text-decoration: underline; }
.text-danger-link { color: var(--danger); }
.fw-500 { font-weight: 500; }
.fs-13 { font-size: 13px; }
.fs-12 { font-size: 12px; }
.fs-11 { font-size: 11px; }
.pre-wrap { white-space: pre-wrap; }

.eq-number {
    font-size: 13px;
    font-weight: 700;
    color: bisque;
}

/* ── Form Grids ─────────────────────────────────────────────────────────────── */

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.col-span-2  { grid-column: 1 / -1; }

@media (max-width: 600px) {
  .form-grid-2,
  .form-grid-3 { grid-template-columns: 1fr; }
  .col-span-2  { grid-column: 1; }
}

/* ── Additional Utilities ───────────────────────────────────────────────────── */

.hidden         { display: none !important; }
.items-start    { align-items: flex-start; }
.flex-shrink-0  { flex-shrink: 0; }
.no-wrap        { white-space: nowrap; }
.gap-1          { gap: 4px; }

/* ── Equipment Detail Image Gallery ────────────────────────────────────────── */

.img-detail-main {
  width: 100%;
  height: 220px;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

.img-detail-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
}

.img-detail-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity .15s;
  flex-shrink: 0;
}

.img-detail-thumb.active { opacity: 1; }

/* ── Upload Label ───────────────────────────────────────────────────────────── */

.upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  transition: border-color .15s;
}

.upload-label:hover { border-color: var(--primary-500); }

/* ── Spec Detail List ───────────────────────────────────────────────────────── */

.spec-detail-dl { display: grid; gap: 8px; }

.spec-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.spec-detail-row:last-child { border-bottom: none; }
.spec-detail-row dt { color: var(--text-muted); }
.spec-detail-row dd { font-weight: 500; text-align: right; }

/* ── Card Modifiers ─────────────────────────────────────────────────────────── */

.card-flush { padding: 0 !important; overflow: hidden; }

/* ── Lightbox buttons ────────────────────────────────────────────────────────── */

.lightbox-img     { max-width: 90vw; max-height: 90vh; border-radius: 8px; }
.lightbox-buttons { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; z-index: 10001; }
.lightbox-btn     { background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 36px; height: 36px; padding: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.lightbox-btn:hover { background: rgba(0,0,0,.8); }

/* ── Button Warning variant ──────────────────────────────────────────────────── */

.btn-warning { background: #D97706; color: #fff; border: none; }
.btn-warning:hover { background: #B45309; color: #fff; }
/* Visually disabled but still clickable (shows info modal on click) */
.btn-disabled-look { opacity: 0.45; cursor: not-allowed; }
.btn-disabled-look:hover { opacity: 0.55; }

/* ── Log Feed (Журнал действий) ──────────────────────────────────────────────── */

.log-feed { display: flex; flex-direction: column; gap: 2px; }

.log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: background var(--transition);
}
.log-item:hover { background: var(--bg-muted); }

/* Log icon circle */
.log-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.log-icon.log-success { background: #059669; color: #fff; }
.log-icon.log-info    { background: #2b55b0; color: #fff; }
.log-icon.log-warning { background: #D97706; color: #fff; }
.log-icon.log-danger  { background: #DC2626; color: #fff; }
.log-icon.log-muted   { background: #6B7280; color: #fff; }

/* Log body */
.log-body { flex: 1; min-width: 0; }

.log-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

/* Action label badge */
.log-action-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.log-action-badge.log-success { background: #059669; color: #fff; }
.log-action-badge.log-info    { background: #2b55b0; color: #fff; }
.log-action-badge.log-warning { background: #D97706; color: #fff; }
.log-action-badge.log-danger  { background: #DC2626; color: #fff; }
.log-action-badge.log-muted   { background: #6B7280; color: #fff; }

/* Raw action code */
.log-code {
  font-size: 12px;
  background: var(--bg-muted);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Timestamp */
.log-time {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* Meta row */
.log-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.log-user, .log-object {
  display: flex;
  align-items: center;
  gap: 3px;
}
.log-system { color: var(--text-muted); font-style: italic; }

.log-details {
  color: var(--text-muted);
  font-size: 12px;
  word-break: break-word;
}

/* Filters row update */
.filters-form  { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters-count { color: var(--text-muted); font-size: 13px; margin-left: auto; }
.filter-select { width: auto; }
.pagination-nav { display: flex; justify-content: center; gap: 4px; margin-top: 16px; }
.pagination-ellipsis { padding: 6px 10px; color: var(--text-muted); }

/* ── Settings page — Members list ──────────────────────────────────────────── */
.members-list { display: flex; flex-direction: column; gap: 8px; }

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  gap: 12px;
}

.member-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.form-control-sm {
  font-size: 12px;
  padding: 4px 8px;
  height: auto;
}

/* ── Invite modal — link result box ─────────────────────────────────────────── */
.invite-link-result {
  display: none;
  padding: 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 12px;
}
.invite-link-result.visible { display: block; }

.mb-3 { margin-bottom: 12px; }

/* ── Super-admin role badge & avatar ────────────────────────────────────────── */
.badge-super-admin {
  background: #D97706;
  color: #fff;
  border: none;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 4px;
}
.member-avatar-super { background: #D97706; }

/* ── flex-1 (fills available space) ─────────────────────────────────────────── */
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.ms-auto { margin-left: auto; }

/* ── Sidebar: logout button lives inside sidebar-user on the right ─────────── */
.sidebar-logout-btn {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--transition);
}
.sidebar-logout-btn:hover { opacity: 1; }

/* ── Card header link (e.g. "Все действия →" on dashboard) ─────────────────── */
.card-header-link {
  font-size: .8rem;
  color: bisque;
  text-decoration: none;
  white-space: nowrap;
}
.card-header-link:hover { text-decoration: underline; }

/* ── Stat card value color modifiers ──────────────────────────────────────── */
.stat-card-value--success { color: var(--success); }
.stat-card-value--info    { color: var(--info); }
.stat-card-value--muted   { color: var(--text-muted); }
.stat-card-value--primary { color: var(--primary-500); }

/* ── Dashboard two-column layout ─────────────────────────────────────────── */
.dash-main-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
@media (max-width: 900px) {
  .dash-main-grid { grid-template-columns: 1fr; }
}

.dash-right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Quick-actions list inside card */
.dash-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}

/* ── Compact log feed for dashboard ─────────────────────────────────────── */
.log-feed-compact .log-item {
  padding: 8px 16px;
}
.log-feed-compact .log-item:last-child {
  border-bottom: none;
}

/* Short detail line in dashboard activity feed */
.dash-log-details {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Equipment type chips (list page) ────────────────────────────────────── */
.eq-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.73rem;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.6;
}
.eq-type--computing { background: #1F77B4; color: #fff; } /* Tableau10: синий — ноутбук, системник */
.eq-type--display   { background: #FF7F0E; color: #fff; } /* Tableau10: оранжевый — монитор        */
.eq-type--input     { background: #2CA02C; color: #fff; } /* Tableau10: зелёный — клавиатура, мышь*/
.eq-type--camera    { background: #9467BD; color: #fff; } /* Tableau10: фиолет — веб-камера        */
.eq-type--audio     { background: #D62728; color: #fff; } /* Tableau10: красный — гарнитура        */
.eq-type--dock      { background: #8C564B; color: #fff; } /* Tableau10: коричневый — док-станция   */
.eq-type--print     { background: #E377C2; color: #fff; } /* Tableau10: розовый — принтер, сканер  */
.eq-type--tablet    { background: #7F7F7F; color: #fff; } /* Tableau10: серый — планшет            */
.eq-type--phone     { background: #17BECF; color: #fff; } /* Tableau10: голубой/cyan — телефон     */
.eq-type--network   { background: #BCBD22; color: #000; } /* Tableau10: жёлто-зелёный — роутер     */
.eq-type--power     { background: #FF7F0E; color: #fff; } /* Tableau10: оранжевый — ИБП            */
.eq-type--other     { background: #7F7F7F; color: #fff; } /* Tableau10: серый — другое             */

/* ── Equipment type colored name links ──────────────────────────────────── */
.eq-name-link { font-weight: 500; text-decoration: none; transition: opacity .15s; }
.eq-name-link:hover { opacity: 0.72; text-decoration: underline; }
.eq-name-link--computing { color: #1F77B4; font-weight: 600; }
.eq-name-link--display   { color: #FF7F0E; font-weight: 600; }
.eq-name-link--input     { color: #2CA02C; font-weight: 600; }
.eq-name-link--camera    { color: #9467BD; font-weight: 600; }
.eq-name-link--audio     { color: #D62728; font-weight: 600; }
.eq-name-link--dock      { color: #8C564B; font-weight: 600; }
.eq-name-link--print     { color: #E377C2; font-weight: 600; }
.eq-name-link--tablet    { color: #7F7F7F; font-weight: 600; }
.eq-name-link--phone     { color: #17BECF; font-weight: 600; }
.eq-name-link--network   { color: #9C9B00; font-weight: 600; }
.eq-name-link--power     { color: #D46A00; font-weight: 600; }
.eq-name-link--other     { color: #7F7F7F; font-weight: 600; }

/* ── Equipment list table ────────────────────────────────────────────────── */
.eq-table .col-cb   { width: 36px; padding-left: 12px; }
.col-cb-cell        { padding-left: 12px; }
.eq-row             { cursor: pointer; }
.eq-table .col-action { width: 48px; text-align: right; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.ml-1  { margin-left:  4px; }
.ml-2  { margin-left:  8px; }
.mr-1  { margin-right: 4px; }
.fw-500 { font-weight: 500; }
.fs-11  { font-size: 11px; }
.fs-12  { font-size: 12px; }
.font-mono { font-family: 'Roboto Mono', 'Courier New', monospace; }
.mt-3   { margin-top: 16px; }
.mt-4   { margin-top: 20px; }
.mb-4   { margin-bottom: 20px; }
.ms-auto { margin-left: auto; }

/* ── Profile page ────────────────────────────────────────────────────────── */
.profile-page {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.profile-card { padding: 28px 32px; }
.profile-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.profile-avatar-big {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-500);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-name    { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.profile-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
/* ── Password input with toggle ─────────────────────────────────────────── */
.pw-input-wrap { position: relative; display: flex; align-items: center; }
.pw-input-wrap .form-control { padding-right: 40px; }
.pw-toggle-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  line-height: 1;
}
.pw-toggle-btn:hover { color: var(--text-primary); }
/* ── Password strength bar ──────────────────────────────────────────────── */
.pw-strength-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width .25s, background .25s;
}
/* ── Sidebar user link ───────────────────────────────────────────────────── */
.sidebar-user-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-md);
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background .15s;
}
.sidebar-user-link:hover { background: rgba(255,255,255,.08); }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ── Phase 4: Security-hardening classes (replaces inline styles/handlers) ── */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ── Utility: display helpers ────────────────────────────────────────────── */
.d-block { display: block; }

/* ── Utility: extra margins / spacing ────────────────────────────────────── */
.mb-0  { margin-bottom: 0 !important; }
.mb-1  { margin-bottom:  4px; }
.mb-2  { margin-bottom:  8px; }
.mt-1  { margin-top:     4px; }
.mt-2  { margin-top:     8px; }
.ml-6  { margin-left:   24px; }

/* ── Form hidden (initially hidden, can be toggled by JS via style.display) ─ */
.form-hidden { display: none; }

/* ── Form inline (replaces style="display:inline;" on form elements) ──────── */
.form-inline { display: inline; }

/* ── Table empty state cell ──────────────────────────────────────────────── */
.table-empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
}

/* ── Card heading (larger h3, not the small all-caps card-section-title) ─── */
.card-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Icon inline alignment helper ────────────────────────────────────────── */
.icon-inline {
  display: inline-flex;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ── Form control short width ────────────────────────────────────────────── */
.form-control-short { width: 120px; }

/* ── Form stack (vertical grid for form groups) ──────────────────────────── */
.form-stack { display: grid; gap: 14px; }

/* ── Settings two-column layout ──────────────────────────────────────────── */
.settings-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 768px) {
  .settings-layout-grid { grid-template-columns: 1fr; }
}

/* ── Page header row (space-between flex row) ────────────────────────────── */
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ── Modal overlay (full-screen backdrop — mirrors .modal-backdrop) ──────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
}

/* ── Modal dialog box (centered card — mirrors .modal-box) ──────────────── */
.modal-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}

/* ── Modal box size variants ─────────────────────────────────────────────── */
.modal-box-420 { max-width: 420px; }

/* ── Audit sessions list: progress column ────────────────────────────────── */
.audit-progress-cell  { min-width: 120px; }
.audit-progress-wrap  { display: flex; align-items: center; gap: 8px; }
.audit-progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
/* Width driven by CSS custom property --progress set on the element */
.audit-progress-bar {
  height: 100%;
  width: var(--progress, 0%);
  background: var(--primary-500);
  border-radius: 3px;
  transition: width .3s;
}
.audit-progress-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Audit session detail: 4-column stats grid ───────────────────────────── */
.audit-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 700px) {
  .audit-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.audit-stat-card {
  text-align: center;
  padding: 16px;
}

.audit-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}
.audit-stat-value--success { color: var(--success); }
.audit-stat-value--danger  { color: var(--danger); }
.audit-stat-value--muted   { color: var(--text-muted); }

/* ── Audit session detail: progress bar (large) ──────────────────────────── */
.audit-progress-card { padding: 16px; }
.audit-progress-track-lg {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
/* Width driven by CSS custom property --progress set inline on the element */
.audit-progress-fill {
  height: 100%;
  width: var(--progress, 0%);
  background: var(--primary-500);
  border-radius: 4px;
  transition: width .3s;
}

/* ── Text utilities ───────────────────────────────────────────────────────── */
.text-break    { word-break: break-all; }
.text-italic   { font-style: italic; }
.text-nowrap   { white-space: nowrap; }
.flex-shrink-0 { flex-shrink: 0; }
.fs-14         { font-size: 14px; }

/* ── Margin: mb-6 (24px) ─────────────────────────────────────────────────── */
.mb-6 { margin-bottom: 24px; }

/* ── Equipment import page ────────────────────────────────────────────────── */
.import-content-wrap   { max-width: 640px; }
.import-section-title  { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.import-instructions   { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.drop-zone-icon-wrap   { color: var(--text-muted); margin-bottom: 8px; }
.drop-zone-label       { font-size: 0.9rem; color: var(--text-muted); }
.drop-zone-link        { color: var(--primary-500); cursor: pointer; }
.drop-zone-filename    { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; }
.import-rules-title    { font-size: 0.95rem; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.import-rules-table    { width: 100%; font-size: 0.8rem; border-collapse: collapse; }
.import-rules-th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.import-rules-td      { padding: 5px 8px; }
.import-rules-row     { border-bottom: 1px solid var(--border); }
.import-rules-mapped  { color: var(--text-muted); }
.import-notes         { margin-top: 16px; font-size: 0.8rem; color: var(--text-muted); }
