/* ════════════════════════════════════════
   КорпПортал — Dark Blue Theme
   ════════════════════════════════════════ */

:root {
  --bg-deep:    #060d1a;
  --bg-base:    #0a1628;
  --bg-card:    #0f2040;
  --bg-hover:   #162a52;
  --border:     #1e3a6e;
  --border-light: #234080;

  --blue-primary: #3b82f6;
  --blue-bright:  #60a5fa;
  --blue-glow:    #1d4ed8;
  --blue-muted:   #1e40af;

  --text-primary: #e2e8f0;
  --text-sub:     #94a3b8;
  --text-muted:   #64748b;

  --success: #22c55e;
  --danger:  #ef4444;
  --warning: #f59e0b;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --glow: 0 0 20px rgba(59,130,246,0.15);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--blue-bright); text-decoration: none; }
a:hover { color: #93c5fd; }

/* ─── NAVBAR ────────────────────────────────────── */
.navbar {
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 60px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px;
  color: var(--blue-bright);
  margin-right: 32px;
}
.nav-logo { font-size: 22px; }

.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--text-sub);
  font-size: 14px;
  transition: all 0.2s;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active { background: var(--blue-muted); color: var(--blue-bright); }
.nav-icon { font-size: 16px; }

.nav-user {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
}
.user-badge {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px;
  font-size: 13px; color: var(--text-sub);
}
.admin-badge {
  background: var(--blue-muted); color: var(--blue-bright);
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700;
}
.btn-logout {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 5px 12px; border-radius: var(--radius);
  font-size: 13px; transition: all 0.2s; cursor: pointer;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

.burger {
  display: none; background: none; border: none;
  color: var(--text-primary); font-size: 22px; cursor: pointer; margin-left: 12px;
}

/* ─── MOBILE MENU ───────────────────────────────── */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 60px; z-index: 99;
}
.mobile-menu.open { display: flex; }
.mob-link {
  padding: 14px 24px;
  color: var(--text-sub); border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.mob-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.mob-link.logout { color: var(--danger); }

/* ─── MAIN CONTENT ──────────────────────────────── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* ─── FLASH MESSAGES ─────────────────────────────── */
.flash-container { margin-bottom: 20px; }
.flash {
  padding: 12px 18px; border-radius: var(--radius);
  margin-bottom: 8px; font-size: 14px;
  border-left: 3px solid;
}
.flash-success { background: rgba(34,197,94,0.1);  border-color: var(--success); color: #86efac; }
.flash-error   { background: rgba(239,68,68,0.1);   border-color: var(--danger);  color: #fca5a5; }
.flash-info    { background: rgba(59,130,246,0.1);  border-color: var(--blue-primary); color: var(--blue-bright); }

/* ─── PAGE HEADER ────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 26px; font-weight: 700; color: var(--text-primary); }
.page-sub { color: var(--text-sub); margin-top: 4px; font-size: 14px; }

.back-link { display: inline-block; color: var(--text-muted); font-size: 14px; margin-bottom: 8px; }
.back-link:hover { color: var(--blue-bright); }

/* ─── LOGIN ──────────────────────────────────────── */
.login-body {
  background: radial-gradient(ellipse at 50% 0%, #0f2040 0%, #060d1a 70%);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow), var(--glow);
  text-align: center;
}
.login-logo {
  font-size: 48px; color: var(--blue-bright);
  margin-bottom: 12px;
}
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.login-form { text-align: left; }

/* ─── FORMS ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: var(--bg-base); border: 1px solid var(--border);
  color: var(--text-primary); padding: 10px 14px;
  border-radius: var(--radius); font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── BUTTONS ─────────────────────────────────────── */
.btn-primary {
  background: var(--blue-primary); color: #fff;
  border: none; padding: 10px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  display: inline-block;
}
.btn-primary:hover { background: var(--blue-glow); box-shadow: 0 0 12px rgba(59,130,246,0.4); color: #fff; }
.btn-outline {
  background: transparent; color: var(--blue-bright);
  border: 1px solid var(--blue-primary); padding: 10px 20px;
  border-radius: var(--radius); font-size: 14px; cursor: pointer;
  display: inline-block; transition: all 0.2s;
}
.btn-outline:hover { background: rgba(59,130,246,0.1); color: var(--blue-bright); }
.btn-danger {
  background: rgba(239,68,68,0.15); color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3); padding: 10px 20px;
  border-radius: var(--radius); font-size: 14px; cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.3); }
.btn-sm  { padding: 6px 14px; font-size: 13px; }
.btn-xs  { padding: 3px 10px; font-size: 12px; border-radius: 4px; cursor: pointer; }
.btn-blue { background: rgba(59,130,246,0.15); color: var(--blue-bright); border: 1px solid var(--border-light); }
.btn-blue:hover { background: rgba(59,130,246,0.3); }
.btn-xs.btn-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.btn-xs.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-xs.disabled { opacity: 0.4; cursor: default; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); }
.w-full { width: 100%; }
.link-btn { background: none; border: none; color: var(--blue-bright); cursor: pointer; font-size: 14px; }

/* ─── CARDS ───────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-header {
  padding: 14px 20px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; font-weight: 600; color: var(--blue-bright);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.card-header:hover { background: var(--bg-hover); }
.card-body { padding: 20px; }
.mb-4 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 14px; }
.collapse { display: none; }

/* ─── DASHBOARD CARDS ────────────────────────────── */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; margin-bottom: 32px;
}
.dash-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 24px;
  display: flex; align-items: center; gap: 20px;
  transition: all 0.25s; cursor: pointer; color: var(--text-primary);
  position: relative; overflow: hidden;
}
.dash-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--blue-primary), #818cf8);
  transform: scaleX(0); transform-origin: left; transition: transform 0.3s;
}
.dash-card:hover { background: var(--bg-hover); border-color: var(--blue-primary); color: var(--text-primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.dash-card:hover::before { transform: scaleX(1); }
.dash-card-icon { font-size: 36px; flex-shrink: 0; }
.qr-icon { color: var(--blue-bright); }
.dash-card-body h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.dash-card-body p  { font-size: 13px; color: var(--text-muted); }
.dash-card-arrow { margin-left: auto; color: var(--blue-primary); font-size: 20px; }

.info-strip {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 24px;
  display: flex; gap: 32px; flex-wrap: wrap;
}
.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.info-val { font-size: 14px; font-weight: 600; }
.role-admin { color: var(--blue-bright); }
.online { color: var(--success); }

/* ─── QR GRID ─────────────────────────────────────── */
.qr-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.qr-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: all 0.2s;
}
.qr-card:hover { border-color: var(--blue-primary); box-shadow: var(--glow); }
.qr-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.qr-icon-sm { font-size: 20px; color: var(--blue-bright); }
.qr-title { font-weight: 600; font-size: 15px; }
.qr-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.qr-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.qr-view-wrap {
  display: grid; grid-template-columns: auto 1fr; gap: 40px;
  align-items: start;
}
.qr-display { text-align: center; }
.qr-image {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 260px; width: 100%;
  background: var(--bg-deep);
}
.qr-hint { font-size: 13px; color: var(--text-muted); margin-top: 10px; }
.qr-info-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
}
.info-row { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.info-row:last-of-type { border-bottom: none; }
.info-key { min-width: 90px; font-size: 13px; color: var(--text-muted); }
.link-wrap { word-break: break-all; font-size: 13px; color: var(--blue-bright); }
.qr-btn-group { margin-top: 20px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ─── EXPLORER ─────────────────────────────────────── */
.explorer {
  display: grid; grid-template-columns: 220px 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; min-height: 400px;
}
.explorer-sidebar {
  background: var(--bg-base); border-right: 1px solid var(--border);
  padding: 8px 0;
}
.sidebar-title {
  padding: 10px 16px 6px;
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.sidebar-folder {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  font-size: 13px; color: var(--text-sub);
  border-left: 3px solid transparent;
  transition: all 0.2s; cursor: pointer;
}
.sidebar-folder:hover { background: var(--bg-hover); color: var(--text-primary); border-left-color: var(--blue-primary); }
.file-count {
  margin-left: auto; background: var(--bg-card);
  padding: 1px 7px; border-radius: 10px; font-size: 11px; color: var(--text-muted);
}

.explorer-main { background: var(--bg-card); }
.admin-toolbar { display: flex; gap: 10px; margin-bottom: 12px; }

.kb-folder { border-bottom: 1px solid var(--border); }
.kb-folder:last-child { border-bottom: none; }
.kb-folder-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; cursor: pointer;
  user-select: none; transition: background 0.15s;
  position: relative;
}
.kb-folder-header:hover { background: var(--bg-hover); }
.folder-arrow { color: var(--text-muted); font-size: 12px; transition: transform 0.2s; width: 14px; }
.folder-arrow.open { transform: rotate(90deg); color: var(--blue-bright); }
.folder-icon { font-size: 18px; }
.folder-name { font-weight: 600; font-size: 14px; }
.folder-count { font-size: 12px; color: var(--text-muted); }
.folder-admin-btns { margin-left: auto; display: flex; gap: 6px; }
.folder-admin-btns form { margin: 0; }

.kb-folder-content { padding: 0 20px 16px 44px; }
.folder-empty { padding: 12px 0; color: var(--text-muted); font-size: 14px; }

.file-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.file-table th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.file-row { border-bottom: 1px solid rgba(30,58,110,0.3); transition: background 0.15s; }
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--bg-hover); }
.file-row td { padding: 10px 12px; vertical-align: middle; }
.file-name-cell { display: flex; align-items: center; gap: 8px; }
.file-type-icon { font-size: 16px; }
.file-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.text-muted { color: var(--text-muted); }

/* ─── MODAL ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 480px;
  box-shadow: var(--shadow); overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 15px;
}
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: var(--danger); }
.modal-form { padding: 20px; }
.modal-folder-name { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.modal-footer { display: flex; gap: 10px; margin-top: 16px; }

/* ─── EMPTY STATE ─────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-hint { font-size: 13px; margin-top: 6px; }

.inline-form { display: flex; gap: 10px; align-items: center; }
.inline-form input { flex: 1; }
.upload-form {}

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-user  { display: none; }
  .burger    { display: block; }
  .nav-brand { margin-right: 0; }

  .main-content { padding: 20px 16px 40px; }
  .page-header h1 { font-size: 20px; }

  .form-row { grid-template-columns: 1fr; }

  .qr-view-wrap { grid-template-columns: 1fr; }
  .qr-image { max-width: 200px; }

  .explorer { grid-template-columns: 1fr; }
  .explorer-sidebar {
    border-right: none; border-bottom: 1px solid var(--border);
    display: flex; flex-wrap: wrap; padding: 8px 12px; gap: 6px;
  }
  .sidebar-title { width: 100%; }
  .sidebar-folder {
    border-left: none; border: 1px solid var(--border);
    border-radius: 20px; padding: 5px 12px;
  }

  .hide-mobile { display: none; }
  .kb-folder-header { padding: 12px 14px; }
  .kb-folder-content { padding: 0 14px 12px 28px; }
  .info-strip { gap: 20px; }
  .qr-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }

  .inline-form { flex-wrap: wrap; }
}

@media print {
  .navbar, .admin-toolbar, .btn-primary, .btn-outline, .btn-danger { display: none !important; }
  body { background: white; color: black; }
  .qr-image { border-color: #ccc; }
}

/* QR canvas styling */
.qr-canvas-wrap {
  display: inline-block;
  padding: 12px;
  background: #0a1628;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
}
.qr-canvas-wrap canvas, .qr-canvas-wrap img {
  display: block;
}

/* ═══════════════════════════════════════════════════
   EXPLORER — файловый менеджер
   ═══════════════════════════════════════════════════ */

/* Хлебные крошки */
.breadcrumbs {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 4px; margin-top: 8px; font-size: 13px;
}
.crumb { color: var(--blue-bright); padding: 2px 6px; border-radius: 4px; }
.crumb:hover { background: var(--bg-hover); }
.crumb-root { color: var(--text-muted); }
.crumb-sep { color: var(--text-muted); }

/* Тулбар */
.kb-toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.toolbar-hint { font-size: 12px; color: var(--text-muted); }
.toolbar-hint code { background: var(--bg-card); padding: 1px 6px; border-radius: 4px;
  color: var(--blue-bright); font-family: monospace; }

/* Панели (collapsible) */
.panel-collapse {
  display: none;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 14px;
}
.panel-collapse.open { display: block; }
.inline-panel { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.inline-panel .form-group { margin-bottom: 0; }

/* Таблица проводника */
.explorer-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.explorer-table { width: 100%; border-collapse: collapse; }
.explorer-table th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--bg-base); border-bottom: 1px solid var(--border);
}
.col-name    { width: 50%; }
.col-size    { width: 10%; }
.col-date    { width: 14%; }
.col-actions { width: 130px; }

.explorer-row { border-bottom: 1px solid rgba(30,58,110,.25); transition: background .13s; }
.explorer-row:last-child { border-bottom: none; }
.explorer-row:hover { background: var(--bg-hover); }

.folder-row .col-name { font-weight: 600; }

.col-name { padding: 0; }
.node-link {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px; color: var(--text-primary); width: 100%;
}
.node-link:hover { color: var(--text-primary); }
.folder-link:hover .node-name { color: var(--blue-bright); }
.file-link:hover .node-name { text-decoration: underline; color: var(--blue-bright); }
.node-icon { font-size: 17px; flex-shrink: 0; }
.node-name  { flex: 1; word-break: break-word; }
.folder-badge {
  background: var(--bg-base); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 10px; font-size: 11px;
  color: var(--text-muted); font-weight: 400;
}

.col-size, .col-date { padding: 11px 16px; vertical-align: middle; font-size: 13px; }
.col-actions { padding: 8px 12px; vertical-align: middle; }

.row-actions { display: flex; gap: 5px; }
.row-actions form { margin: 0; }

@media (max-width: 768px) {
  .hide-mobile { display: none; }
  .kb-toolbar { gap: 8px; }
  .col-article { display: none; }
  .col-actions { width: auto; }
  .row-actions { flex-wrap: wrap; gap: 4px; }
  .node-link { padding: 10px 10px; gap: 7px; }
  .node-name { min-width: 0; }
}

/* ═══════════════════════════════════════════════════
   ПОИСК ПО БАЗЕ ЗНАНИЙ
   ═══════════════════════════════════════════════════ */

.kb-search-form { margin-bottom: 20px; }
.kb-search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 6px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.kb-search-wrap:focus-within {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.kb-search-icon { font-size: 16px; color: var(--text-muted); flex-shrink: 0; }
.kb-search-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 14px; padding: 4px 0;
}
.kb-search-input::placeholder { color: var(--text-muted); }
.kb-search-clear {
  color: var(--text-muted); font-size: 14px; padding: 2px 6px;
  border-radius: 4px; cursor: pointer; flex-shrink: 0;
  line-height: 1;
}
.kb-search-clear:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

.search-header {
  margin-bottom: 14px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.search-count { font-size: 14px; color: var(--text-sub); }

.col-path { width: 24%; }

@media (max-width: 768px) {
  .kb-search-wrap { padding: 5px 10px; }
}

/* ═══════════════════════════════════════════════════
   КОРОТКИЕ ССЫЛКИ / SHORT URL
   ═══════════════════════════════════════════════════ */

.short-url-badge {
  margin: 14px auto 4px;
  max-width: 260px;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: var(--radius);
  padding: 8px 14px;
  text-align: center;
}
.short-url-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.short-url-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue-bright);
  word-break: break-all;
}
.short-url-val:hover { text-decoration: underline; }

.short-link-pill {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-bright);
  word-break: break-all;
}
.short-link-pill:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════
   НАВИГАЦИЯ — КНОПКА СКАНЕРА
   ═══════════════════════════════════════════════════ */

.nav-link-scan {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
}
.nav-link-scan:hover,
.nav-link-scan.active {
  background: var(--blue-muted) !important;
  border-color: var(--blue-primary);
  color: var(--blue-bright) !important;
}
.mob-link-scan {
  color: var(--blue-bright) !important;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   СКАНЕР QR-КОДОВ
   ═══════════════════════════════════════════════════ */

.scan-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.scan-camera-card {
  grid-column: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.scan-viewport-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  overflow: hidden;
}
.scan-video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.scan-canvas { display: none; }

/* Прицел */
.scan-reticle {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.reticle-corner {
  position: absolute;
  width: 36px; height: 36px;
  border-color: var(--blue-bright);
  border-style: solid;
  border-width: 0;
}
.tl { top: 22%; left: 15%; border-top-width: 3px; border-left-width: 3px;  border-radius: 4px 0 0 0; }
.tr { top: 22%; right:15%; border-top-width: 3px; border-right-width: 3px; border-radius: 0 4px 0 0; }
.bl { bottom:22%; left: 15%; border-bottom-width:3px; border-left-width: 3px; border-radius:0 0 0 4px; }
.br { bottom:22%; right:15%; border-bottom-width:3px; border-right-width:3px; border-radius:0 0 4px 0; }

.scan-line {
  position: absolute;
  left: 15%; right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue-bright), transparent);
  box-shadow: 0 0 8px var(--blue-primary);
  animation: scanLineMove 2s ease-in-out infinite;
  animation-play-state: paused;
  top: 22%;
}
@keyframes scanLineMove {
  0%   { top: 23%; }
  50%  { top: 74%; }
  100% { top: 23%; }
}

.scan-overlay-status {
  display: none;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(6,13,26,0.82);
  backdrop-filter: blur(4px);
  color: var(--blue-bright);
  font-size: 13px;
  padding: 8px 16px;
  align-items: center;
  gap: 8px;
}
.scan-pulse {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--blue-bright);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity:1; transform:scale(1); }
  50%       { opacity:.4; transform:scale(.7); }
}

.scan-controls {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.scan-manual { padding: 14px 18px; }
.scan-manual-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.scan-manual-row { display: flex; gap: 8px; }
.scan-manual-input {
  flex: 1;
  background: var(--bg-base); border: 1px solid var(--border);
  color: var(--text-primary); padding: 8px 12px;
  border-radius: var(--radius); font-size: 13px;
}
.scan-manual-input:focus {
  outline: none; border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* Карточка результата — правая колонка */
.scan-result-card {
  grid-column: 2;
  background: var(--bg-card);
  border: 1px solid var(--blue-primary);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 0 24px rgba(59,130,246,0.15);
}
.scan-result-icon  { font-size: 48px; margin-bottom: 10px; }
.scan-result-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }
.scan-result-url {
  font-size: 12px; color: var(--text-muted);
  word-break: break-all; margin-bottom: 20px;
  background: var(--bg-base); padding: 8px 12px;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.scan-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* История */
.scan-history-card {
  grid-column: 2;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.scan-history-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-sub);
}
.scan-history-list { list-style: none; max-height: 260px; overflow-y: auto; }
.scan-history-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(30,58,110,0.3);
  transition: background 0.13s;
}
.scan-history-item:last-child { border-bottom: none; }
.scan-history-item:hover { background: var(--bg-hover); }
.history-url {
  font-size: 13px; color: var(--blue-bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-time { font-size: 11px; color: var(--text-muted); }

/* Адаптив сканера */
@media (max-width: 900px) {
  .scan-layout { grid-template-columns: 1fr; }
  .scan-result-card,
  .scan-history-card { grid-column: 1; }
}
@media (max-width: 600px) {
  .scan-viewport-wrap { aspect-ratio: 1/1; }
  .tl,.bl { left: 8%; }
  .tr,.br { right: 8%; }
}

/* ═══════════════════════════════════════════════════
   СКАНЕР — исправление layout и новые элементы
   ═══════════════════════════════════════════════════ */

/* Правая колонка — всегда занимает место */
.scan-right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Заглушка "нажмите запустить" */
.scan-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: absolute;
  inset: 0;
  background: var(--bg-base);
  color: var(--text-muted);
  font-size: 14px;
  z-index: 1;
}
.scan-placeholder-icon { font-size: 48px; opacity: .5; }

/* Подсказка "как сканировать" */
.scan-tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}
.scan-tip-icon  { font-size: 36px; margin-bottom: 10px; }
.scan-tip-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; color: var(--text-primary); }
.scan-tip-list  {
  list-style: none;
  text-align: left;
  display: inline-block;
}
.scan-tip-list li {
  font-size: 13px;
  color: var(--text-sub);
  padding: 4px 0 4px 18px;
  position: relative;
}
.scan-tip-list li::before {
  content: "→";
  position: absolute; left: 0;
  color: var(--blue-bright);
}

/* Viewport — position:relative чтобы absolute дочерние работали */
.scan-viewport-wrap { position: relative; }

/* ═══════════════════════════════════════════════════
   НАВИГАЦИЯ — КНОПКА ЛОГОВ (только admin)
   ═══════════════════════════════════════════════════ */
.nav-link-logs {
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.2);
}
.nav-link-logs:hover,
.nav-link-logs.active {
  background: rgba(245,158,11,0.15) !important;
  border-color: #f59e0b;
  color: #f59e0b !important;
}

/* Навигация — кнопка пользователей */
.nav-link-users {
  background: rgba(167,139,250,0.07);
  border: 1px solid rgba(167,139,250,0.2);
}
.nav-link-users:hover,
.nav-link-users.active {
  background: rgba(167,139,250,0.15) !important;
  border-color: #a78bfa;
  color: #a78bfa !important;
}

/* Карточки — 3 и 4 в ряд для admin */
@media (min-width: 900px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════
   SERVER ADDRESSES — блок IP на дашборде
   ═══════════════════════════════════════════════════ */
.server-addresses {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.server-addresses-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
}
.sa-icon  { font-size: 18px; }
.sa-title { font-weight: 700; font-size: 14px; color: var(--blue-bright); }
.sa-hint  { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.sa-list  { padding: 8px 0; }
.sa-item  {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(30,58,110,.2);
  transition: background .13s;
}
.sa-item:last-child { border-bottom: none; }
.sa-item:hover { background: var(--bg-hover); }
.sa-item.sa-local { opacity: .7; }
.sa-left { display: flex; align-items: center; gap: 14px; flex: 1; }
.sa-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted); letter-spacing: .05em; min-width: 70px;
}
.sa-url   { font-family: monospace; font-size: 14px; color: var(--blue-bright); }
.sa-url:hover { text-decoration: underline; }
.sa-copy  { flex-shrink: 0; }

@media (max-width: 600px) {
  .sa-hint { display: none; }
}

/* ═══════════════════════════════════════════════════
   АРТИКУЛЫ — колонка в таблице базы знаний
   ═══════════════════════════════════════════════════ */
.col-article {
  width: 110px;
  padding: 8px 10px;
  vertical-align: middle;
  text-align: center;
}
.article-badge {
  display: inline-block;
  font-family: monospace;
  font-size: 12px; font-weight: 700;
  color: var(--blue-bright);
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.3);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.article-badge:hover { background: rgba(59,130,246,.25); color: #93c5fd; }
.article-empty { font-size: 12px; color: var(--text-muted); }
.article-gen-btn { font-size: 11px !important; white-space: nowrap; }

/* ═══════════════════════════════════════════════════
   QR EDITOR — страница kb_qr.html
   ═══════════════════════════════════════════════════ */
.qr-editor-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: start;
}

/* ── Левая панель: превью + артикул ── */
.qr-editor-left { display: flex; flex-direction: column; gap: 16px; }

.qr-preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}
.qr-preview-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 14px;
}
.qr-preview-url {
  margin-top: 12px; font-size: 11px;
  word-break: break-all; color: var(--text-muted);
}
.qr-preview-url a { color: var(--blue-bright); }

/* Панель артикула */
.article-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.article-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--text-sub);
  margin-bottom: 10px;
}
.article-number { text-align: center; margin-bottom: 10px; }
.article-badge-lg {
  display: inline-block;
  font-family: monospace;
  font-size: 22px; font-weight: 700;
  color: var(--blue-bright);
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.3);
  border-radius: 8px;
  padding: 6px 18px;
  letter-spacing: .08em;
}
.article-edit-row {
  display: flex; gap: 6px; align-items: center; margin-top: 8px;
}
.article-edit-input {
  flex: 1; background: var(--bg-base); border: 1px solid var(--border);
  color: var(--text-primary); padding: 6px 10px;
  border-radius: var(--radius); font-size: 14px; font-family: monospace;
}
.article-edit-input:focus { outline: none; border-color: var(--blue-primary); }

/* ── Правая панель: настройки ── */
.qr-editor-right { display: flex; flex-direction: column; gap: 20px; }

.qr-settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.qr-settings-title {
  font-weight: 700; font-size: 15px; margin-bottom: 18px;
  color: var(--text-primary);
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.qr-settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-bottom: 18px;
}
.qr-setting-group { display: flex; flex-direction: column; gap: 6px; }
.qr-setting-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-sub); text-transform: uppercase; letter-spacing: .04em;
}

/* Слайдеры размера/отступа */
.qr-slider-wrap { display: flex; align-items: center; gap: 10px; }
.qr-slider {
  flex: 1; height: 4px; cursor: pointer;
  accent-color: var(--blue-primary);
}
.qr-slider-val {
  font-size: 13px; font-weight: 700; color: var(--blue-bright);
  min-width: 22px; text-align: right;
}
.qr-slider-hints {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-muted);
}

/* Цвета */
.color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.color-pick {
  width: 36px; height: 36px; padding: 2px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent; cursor: pointer;
}
.color-hex {
  width: 84px; background: var(--bg-base); border: 1px solid var(--border);
  color: var(--text-primary); padding: 6px 8px; border-radius: var(--radius);
  font-size: 12px; font-family: monospace;
}
.color-hex:focus { outline: none; border-color: var(--blue-primary); }
.color-presets { display: flex; gap: 5px; flex-wrap: wrap; }
.color-presets button {
  width: 22px; height: 22px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,.1);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.color-presets button:hover {
  transform: scale(1.2);
  box-shadow: 0 0 6px rgba(255,255,255,.3);
}

/* Быстрые темы */
.qr-themes {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.qr-themes-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.theme-btn {
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px; font-size: 12px;
  color: var(--text-sub); cursor: pointer; transition: all .15s;
}
.theme-btn:hover {
  background: var(--bg-hover);
  border-color: var(--blue-primary);
  color: var(--text-primary);
}

/* Панель кнопок действий */
.qr-action-bar { display: flex; gap: 10px; flex-wrap: wrap; }

/* Адаптив редактора */
@media (max-width: 900px) {
  .qr-editor-layout { grid-template-columns: 1fr; }
  .qr-editor-left  { order: 2; }
  .qr-editor-right { order: 1; }
}
@media (max-width: 600px) {
  .qr-settings-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════
   ТЕХ. УЧЁБА — навигация и страница
   ═══════════════════════════════════════════════════ */

/* Кнопка в navbar */
.nav-link-training {
  background: rgba(163,230,53,0.07);
  border: 1px solid rgba(163,230,53,0.2);
}
.nav-link-training:hover,
.nav-link-training.active {
  background: rgba(163,230,53,0.15) !important;
  border-color: #a3e635;
  color: #a3e635 !important;
}

/* Мобильное меню */
.mob-link-training {
  color: #a3e635 !important;
  font-weight: 600;
}

/* Карточка на дашборде */
.dash-card-training::before {
  background: linear-gradient(90deg, #a3e635, #4ade80) !important;
}
.dash-card-training:hover {
  border-color: #a3e635 !important;
  box-shadow: 0 0 20px rgba(163,230,53,0.12) !important;
}

/* Заголовок страницы */
.tr-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tr-header-badge {
  background: rgba(163,230,53,0.1);
  border: 1px solid rgba(163,230,53,0.3);
  color: #a3e635;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
  align-self: center;
}

/* Иконки файлов — чуть зеленее акцент */
.tr-file-icon { filter: hue-rotate(60deg) saturate(1.2); }

/* Пустое состояние */
.empty-state .empty-icon { filter: none; }

/* ═══════════════════════════════════════════════════
   FILE VIEWER MODAL
   ═══════════════════════════════════════════════════ */
.fv-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.fv-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 1200px;
  height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  box-shadow: 0 8px 48px rgba(0,0,0,0.7);
  overflow: hidden;
}
.fv-header {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-base); flex-shrink: 0;
}
.fv-icon { font-size: 18px; flex-shrink: 0; }
.fv-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.fv-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.fv-body {
  flex: 1; overflow: hidden; background: var(--bg-deep);
  position: relative; display: flex;
}
.fv-iframe {
  width: 100%; height: 100%; border: none; display: block;
  background: #fff;
}
.fv-img-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: auto; padding: 20px;
}
.fv-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: var(--radius);
}
.fv-vid-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: #000; overflow: hidden;
}
.fv-video { max-width: 100%; max-height: 100%; outline: none; }
.fv-aud-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 24px; padding: 40px; color: var(--text-sub);
}
.fv-aud-icon { font-size: 64px; opacity: 0.4; }
.fv-aud-name { font-size: 15px; font-weight: 600; color: var(--text-primary); text-align: center; }
.fv-aud-wrap audio { width: 100%; max-width: 520px; }
.fv-unsupported {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; color: var(--text-muted); text-align: center; padding: 40px;
}
.fv-unsupported-icon { font-size: 72px; opacity: 0.25; }
.fv-unsupported p { font-size: 15px; }
.fv-unsupported small { font-size: 12px; color: var(--text-muted); }

/* ── Просмотр документов (PDF / Word) ── */
.fv-doc-scroll {
  flex: 1; width: 100%; overflow: auto;
  background: #525659;
  padding: 16px; gap: 16px;
  display: flex; flex-direction: column; align-items: center;
  -webkit-overflow-scrolling: touch;
}
.fv-pdf-canvas {
  max-width: 100%; height: auto;
  background: #fff; border-radius: 2px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.55);
}
.fv-doc-loading {
  margin: auto; padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: #e5e7eb; text-align: center;
}
.fv-doc-loading p { font-size: 14px; font-weight: 600; }
.fv-docx-page { width: 100%; display: flex; justify-content: center; }
/* docx-preview встраивает свою разметку — подгоняем под тёмный фон */
.fv-doc-scroll .docx-wrapper {
  background: transparent; padding: 0; margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.fv-doc-scroll .docx-wrapper > section.docx {
  box-shadow: 0 2px 14px rgba(0,0,0,0.55);
  margin: 0; max-width: 100%;
}

@media (max-width: 768px) {
  .fv-doc-scroll { padding: 8px; gap: 8px; }
  /* На узких экранах масштабируем страницу Word по ширине */
  .fv-doc-scroll .docx-wrapper > section.docx {
    width: 100% !important; min-width: 0 !important;
    padding-left: 12px !important; padding-right: 12px !important;
  }
}

/* ── Xcode (transcode) overlay ── */
.fv-xcode-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; background: var(--bg-deep);
  color: var(--text-sub); text-align: center; padding: 24px;
}
.fv-xcode-overlay p  { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.fv-xcode-overlay small { font-size: 12px; color: var(--text-muted); }
.fv-xcode-err-icon   { font-size: 48px; opacity: .6; }

.fv-xcode-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue-bright);
  border-radius: 50%;
  animation: fvSpin 0.9s linear infinite;
}
@keyframes fvSpin { to { transform: rotate(360deg); } }

.fv-xcode-dots::after {
  content: '';
  animation: fvDots 1.5s steps(4, end) infinite;
}
@keyframes fvDots {
  0%  { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

@media (max-width: 768px) {
  .fv-modal { height: calc(100vh - 48px); border-radius: var(--radius); }
  .fv-overlay { padding: 8px; }
  .fv-title { font-size: 13px; }
}
