/* ============================================
   ТОКЕНЫ
   ============================================ */
:root {
  /* Нейтральная шкала (OKLCH-inspired, HSL) */
  --n-0:   hsl(220, 20%, 97%);
  --n-50:  hsl(220, 16%, 93%);
  --n-100: hsl(220, 14%, 86%);
  --n-200: hsl(220, 12%, 74%);
  --n-300: hsl(220, 10%, 60%);
  --n-400: hsl(220,  9%, 46%);
  --n-500: hsl(220,  9%, 34%);
  --n-600: hsl(220, 10%, 24%);
  --n-700: hsl(220, 12%, 18%);
  --n-800: hsl(220, 14%, 14%);
  --n-900: hsl(220, 16%, 10%);

  /* Акцент — медицинский синий */
  --a-50:  hsl(210, 100%, 96%);
  --a-100: hsl(210, 100%, 88%);
  --a-200: hsl(210, 96%,  76%);
  --a-300: hsl(210, 92%,  62%);
  --a-400: hsl(210, 88%,  52%);
  --a-500: hsl(210, 88%,  44%);   /* основной акцент */
  --a-600: hsl(210, 88%,  36%);
  --a-700: hsl(210, 88%,  28%);

  /* Семантика */
  --success:  hsl(142, 72%, 36%);
  --warning:  hsl(38,  92%, 50%);
  --danger:   hsl(0,   76%, 52%);
  --info:     hsl(196, 80%, 44%);

  /* Роли поверхностей (светлая тема) */
  --bg:        var(--n-0);
  --bg-raised: #ffffff;
  --bg-card:   #ffffff;
  --border:    var(--n-100);
  --border-subtle: var(--n-50);
  --text:      var(--n-900);
  --text-body: var(--n-700);
  --text-muted:var(--n-400);
  --text-inv:  #ffffff;
  --accent:    var(--a-500);
  --accent-hover: var(--a-600);
  --accent-bg: var(--a-50);

  /* Тени */
  --shadow-sm: 0 1px 2px hsl(220 14% 14% / .06), 0 0 0 1px hsl(220 14% 14% / .04);
  --shadow-md: 0 4px 12px hsl(220 14% 14% / .10), 0 0 0 1px hsl(220 14% 14% / .04);
  --shadow-lg: 0 8px 24px hsl(220 14% 14% / .14), 0 0 0 1px hsl(220 14% 14% / .04);

  /* Радиусы */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  /* Типографика */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Переходы */
  --ease: cubic-bezier(.4,0,.2,1);
  --dur:  160ms;

  /* Sidebar widths */
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 70px;

  /* Compat aliases for legacy inline references */
  --color-accent:  var(--accent);
  --color-muted:   var(--text-muted);
  --surface-raised: var(--bg-raised);
}

/* Тёмная тема */
[data-theme="dark"] {
  --bg:        var(--n-900);
  --bg-raised: var(--n-800);
  --bg-card:   var(--n-800);
  --border:    var(--n-700);
  --border-subtle: var(--n-700);
  --text:      var(--n-0);
  --text-body: var(--n-100);
  --text-muted:var(--n-400);
  --accent:    hsl(210, 88%, 60%);
  --accent-hover: hsl(210, 88%, 68%);
  --accent-bg: hsl(210, 40%, 18%);
  --shadow-sm: 0 1px 2px hsl(0 0% 0% / .18), 0 0 0 1px hsl(0 0% 0% / .12);
  --shadow-md: 0 4px 12px hsl(0 0% 0% / .28), 0 0 0 1px hsl(0 0% 0% / .12);
  --shadow-lg: 0 8px 24px hsl(0 0% 0% / .36), 0 0 0 1px hsl(0 0% 0% / .12);
}



/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-body);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }



/* ============================================
   LAYOUT — SIDEBAR + MAIN
   ============================================ */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .sidebar { display: none; }
  .sidebar--open {
    display: flex !important;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 200;
    width: 280px;
    box-shadow: var(--shadow-lg);
    height: 100vh;
    overflow-y: auto;
    animation: slideInLeft 200ms var(--ease) both;
  }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}



/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--dur) var(--ease);
  width: var(--sidebar-w);
  z-index: 10;
}

/* Collapsed sidebar on desktop */
.app-layout.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-w);
}

/* Mobile sidebar: hidden by default, overlay when open */
@media (max-width: 900px) {
  .sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 200;
    width: 280px !important;
    box-shadow: var(--shadow-lg);
    height: 100vh;
    overflow-y: auto;
  }
  .sidebar.sidebar--open {
    display: flex !important;
    animation: slideInLeft 200ms var(--ease) both;
  }
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: hsl(220 14% 10% / .45);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ---- Logo row ---- */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 64px;
  overflow: hidden;
}

.logo-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.logo-icon img { width: 100%; height: 100%; object-fit: contain; }
.logo-icon svg { width: 20px; height: 20px; fill: #fff; }

.logo-text-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: opacity var(--dur) var(--ease), max-width var(--dur) var(--ease);
}
.logo-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.logo-text {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
}

/* Collapsed state: hide text labels */
.app-layout.sidebar-collapsed .logo-text-wrap,
.app-layout.sidebar-collapsed .nav-label,
.app-layout.sidebar-collapsed .nav-section-title,
.app-layout.sidebar-collapsed .sidebar-user-info {
  display: none;
}

.app-layout.sidebar-collapsed .sidebar-logo {
  justify-content: center;
  padding: 20px 0 16px;
}

.app-layout.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}
.app-layout.sidebar-collapsed .nav-item svg {
  opacity: .8;
}
.app-layout.sidebar-collapsed .nav-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 14px; height: 14px;
  font-size: .6rem;
  padding: 0 3px;
}
.app-layout.sidebar-collapsed .sidebar-footer {
  padding: 12px 0;
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}

/* Show logout button icon in collapsed state */
.app-layout.sidebar-collapsed .sidebar-footer .icon-btn {
  display: flex;
}

.app-layout.sidebar-collapsed .sidebar-user {
  justify-content: center;
}
/* ---- Nav items ---- */
.sidebar-nav { padding: 10px 0; flex: 1; }

.nav-section-title {
  font-size: .66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 14px 20px 5px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-body);
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--accent-bg); color: var(--accent); text-decoration: none; }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

button.nav-item {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
button.nav-item:hover { background: var(--accent-bg); color: var(--accent); }
button.nav-item svg { opacity: .7; }
button.nav-item:hover svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* ---- Sidebar footer / user ---- */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--accent);
  /* BUGFIX #2: contain image strictly inside circle */
  position: relative;
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }

.sidebar-user-info { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { font-size: .72rem; color: var(--text-muted); }





/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  grid-area: topbar;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text); flex: 1; }

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

.icon-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-body);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  position: relative;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-raised);
}

.hamburger { display: none; }
@media (max-width: 900px) { .hamburger { display: flex; } }

/* burger-btn visible on mobile */
.burger-btn { display: none; }
@media (max-width: 900px) { .burger-btn { display: flex; } }

/* ============================================
   ONLINE / OFFLINE TOGGLE BUTTON
   ============================================ */
.online-toggle-btn {
  cursor: pointer;
  position: relative;
}

.online-toggle-icon {
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.online-toggle-icon::before {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--n-300);
  transition: background var(--dur) var(--ease);
}

/* Online state — green dot */
.online-toggle-btn[data-online="1"] .online-toggle-icon::before {
  background: var(--success);
}

/* Offline state — gray dot */
.online-toggle-btn[data-online="0"] .online-toggle-icon::before {
  background: var(--n-300);
}

/* Pulsing ring for online */
.online-pulse {
  display: none;
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--success);
  animation: onlinePulse 3s ease-out infinite;
}

.online-toggle-btn[data-online="1"] .online-pulse {
  display: block;
}

@keyframes onlinePulse {
  0%   { opacity: .8; transform: scale(.8); }
  70%  { opacity: 0;  transform: scale(1.3); }
  100% { opacity: 0;  transform: scale(1.3); }
}

/* Collapsed sidebar: center the dot */
.app-layout.sidebar-collapsed .online-toggle-btn {
  justify-content: center;
  padding: 10px 0;
}

/* sidebar close button — visible only in mobile overlay */
.sidebar-close-btn {
  display: none;
  margin-left: auto;
  flex-shrink: 0;
  width: 30px; height: 30px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  align-items: center; justify-content: center;
}
.sidebar-close-btn svg { width: 18px; height: 18px; }
.sidebar-close-btn:hover { color: var(--text); background: var(--n-50); }
@media (max-width: 900px) { .sidebar-close-btn { display: flex; } }





/* ============================================
   ICON BUTTON
   ============================================ */
.icon-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-body);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  position: relative;
  flex-shrink: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--n-50); border-color: var(--n-200); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* BUGFIX #3: notification badge — shifted to upper-right corner, smaller */
.icon-btn .notif-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px; height: 18px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-raised);
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  pointer-events: none;
}
.icon-btn .notif-dot:empty,
.icon-btn .notif-dot[data-count="0"] { display: none; }



/* ============================================
   MAIN AREA
   ============================================ */
.main { grid-area: main; padding: 28px; overflow-x: hidden; }
.main-content { grid-area: main; padding: 28px; overflow-x: hidden; }

@media (max-width: 640px) { .main { padding: 16px; } .main-content { padding: 16px; } }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.page-sub   { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }



/* ============================================
   КАРТОЧКИ КОНТЕНТА
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: .95rem; font-weight: 600; color: var(--text); }
.card-body  { padding: 20px; }



/* ============================================
   КНОПКИ
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--r-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              transform   var(--dur) var(--ease);
  white-space: nowrap;
  min-height: 38px;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn--primary:hover { background: var(--accent-hover); box-shadow: 0 2px 8px hsl(210 88% 44% / .35); text-decoration: none; color:#fff; }

.btn--secondary {
  background: var(--bg-raised);
  color: var(--text-body);
  border-color: var(--border);
}
.btn--secondary:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn--danger:hover { background: hsl(0,76%,44%); text-decoration: none; color:#fff; }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn--ghost:hover { background: var(--accent-bg); color: var(--accent); text-decoration: none; }

.btn--sm { padding: 5px 12px; font-size: .8rem; min-height: 30px; }
.btn--lg { padding: 11px 24px; font-size: .95rem; }
.btn--full { width: 100%; }

.btn--loading { opacity: .7; pointer-events: none; }
.btn--loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn:disabled { opacity: .45; pointer-events: none; }



/* ============================================
   ФОРМЫ
   ============================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label .req { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .875rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:hover   { border-color: var(--n-200); }
.form-control:focus   { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px hsl(210 88% 44% / .15); }
.form-control.error   { border-color: var(--danger); }
.form-control:focus.error { box-shadow: 0 0 0 3px hsl(0 76% 52% / .12); }

textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.6; }

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

.form-hint  { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; display: none; }
.form-error.show { display: block; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Флажок */
.checkbox-group { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-group input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.checkbox-group span { font-size: .875rem; color: var(--text-body); }



/* ============================================
   ТАБЛИЦА
   ============================================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-body);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--accent-bg); }

.table .num { font-variant-numeric: tabular-nums; text-align: right; }



/* ============================================
   БЕЙДЖИ / СТАТУСЫ
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status--draft     { background: var(--n-100); color: var(--n-500); }
.status--submitted { background: var(--a-50);  color: var(--a-600); }
.status--review    { background: hsl(38,92%,90%); color: hsl(38,70%,35%); }
.status--done      { background: hsl(142,60%,90%); color: hsl(142,60%,28%); }
.status--archived  { background: var(--n-50);  color: var(--n-400); }

[data-theme="dark"] .status--draft     { background: var(--n-700); color: var(--n-300); }
[data-theme="dark"] .status--submitted { background: hsl(210,40%,18%); color: hsl(210,80%,70%); }
[data-theme="dark"] .status--review    { background: hsl(38,40%,18%); color: hsl(38,80%,60%); }
[data-theme="dark"] .status--done      { background: hsl(142,30%,14%); color: hsl(142,60%,55%); }

.type-badge {
  background: var(--a-50);
  color: var(--a-600);
  border: 1px solid var(--a-100);
}

.priority--urgent { background: hsl(38,92%,90%); color: hsl(38,70%,35%); }
.priority--stat   { background: hsl(0,76%,92%); color: hsl(0,60%,40%); }
.priority--normal { background: var(--n-50); color: var(--n-400); }



/* ============================================
   МОДАЛКИ
   ============================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: hsl(220 14% 10% / .5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in .18s var(--ease) both;
}
.modal--lg { max-width: 760px; }
.modal--xl { max-width: 960px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-head h2 { flex: 1; font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close {
  width: 30px; height: 30px;
  border: none; background: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.modal-close:hover { background: var(--n-50); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

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



/* ============================================
   УВЕДОМЛЕНИЯ (FLASH)
   ============================================ */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  margin-bottom: 20px;
  font-size: .875rem;
  animation: flash-in .2s var(--ease) both;
}
@keyframes flash-in { from { opacity:0; transform:translateY(-6px); } }

.flash svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.flash--success { background: hsl(142,60%,94%); color: hsl(142,60%,24%); border: 1px solid hsl(142,50%,80%); }
.flash--error   { background: hsl(0,76%,94%);   color: hsl(0,60%,30%);   border: 1px solid hsl(0,60%,80%); }
.flash--info    { background: var(--a-50);        color: var(--a-700);     border: 1px solid var(--a-100); }
.flash--warning { background: hsl(38,92%,92%);   color: hsl(38,70%,28%);  border: 1px solid hsl(38,80%,76%); }



/* ============================================
   CHIPS / TABS
   ============================================ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 16px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  margin-bottom: -1px;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Chips-фильтры */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.chip:hover  { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }



/* ============================================
   ПОИСК
   ============================================ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px hsl(210 88% 44% / .12); }
.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-bar input { border: none; background: none; padding: 9px 0; flex: 1; color: var(--text); font-size: .875rem; min-width: 0; }
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { outline: none; }



/* ============================================
   SKELETON-ЗАГРУЗКА
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--n-100) 25%, var(--n-50) 50%, var(--n-100) 75%);
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: skeleton-wave 1.4s ease infinite;
}
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, var(--n-700) 25%, var(--n-600) 50%, var(--n-700) 75%);
  background-size: 200% 100%;
}
@keyframes skeleton-wave { to { background-position: -200% 0; } }
.skeleton-text { height: .9em; width: 60%; margin-bottom: 6px; }
.skeleton-text--full { width: 100%; }
.skeleton-text--sm   { width: 30%; }



/* ============================================
   ПУСТОЕ СОСТОЯНИЕ
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state svg { width: 64px; height: 64px; color: var(--n-200); margin: 0 auto 16px; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; color: var(--text-muted); max-width: 300px; margin: 0 auto 20px; }



/* ============================================
   МЕДИА
   ============================================ */
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .hide-mobile { display: none !important; }
  .auth-card { padding: 24px; }
  .modal-body { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}



/* ============================================
   ПРОЧЕЕ
   ============================================ */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .83rem; }
.fw-600      { font-weight: 600; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

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



/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .l-hero__card--notif { animation: none; }
  .reveal-pending { opacity: 1; transform: none; }
  .is-revealed    { transition: none; }
}



/* ============================================
   MISSING UTILITIES & AUTH FIXES
   ============================================ */

/* Hidden utility — used by login tab switching */
.hidden { display: none !important; }

/* Auth tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--n-50);
  border-radius: var(--r-sm);
  padding: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: calc(var(--r-sm) - 2px);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  white-space: nowrap;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
[data-theme="dark"] .auth-tabs { background: var(--n-700); }
[data-theme="dark"] .auth-tab.active { background: var(--n-600); }

/* Auth switch link */
.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: .83rem;
  color: var(--text-muted);
}
.auth-switch a { color: var(--accent); font-weight: 500; }

/* Password visibility toggle */
.input-with-toggle {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-toggle .form-control {
  padding-right: 42px;
  width: 100%;
}
.input-toggle-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur) var(--ease);
  flex-shrink: 0;
  height: 32px;
  width: 32px;
}
.input-toggle-btn svg { width: 18px; height: 18px; pointer-events: none; }
.input-toggle-btn:hover { color: var(--text); }
.input-toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ============================================
   КАРТОЧКИ СТАТИСТИКИ
   ============================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon--blue   { background: var(--a-50);  color: var(--a-500); }
.stat-icon--green  { background: hsl(142,60%,94%); color: var(--success); }
.stat-icon--yellow { background: hsl(38,92%,92%);  color: var(--warning); }
.stat-icon--red    { background: hsl(0,76%,94%);   color: var(--danger); }
.stat-icon--purple { background: hsl(260,60%,94%); color: hsl(260,60%,50%); }

[data-theme="dark"] .stat-icon--blue   { background: hsl(210,40%,18%); }
[data-theme="dark"] .stat-icon--green  { background: hsl(142,30%,14%); }
[data-theme="dark"] .stat-icon--yellow { background: hsl(38,40%,14%);  }
[data-theme="dark"] .stat-icon--red    { background: hsl(0,30%,16%);   }
[data-theme="dark"] .stat-icon--purple { background: hsl(260,30%,16%); }

.stat-body { min-width: 0; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.stat-trend { font-size: .78rem; margin-top: 6px; font-weight: 500; }
.stat-trend--up   { color: var(--success); }
.stat-trend--down { color: var(--danger); }



/* ============================================
   ДЕТАЛЬНАЯ СТРАНИЦА ИССЛЕДОВАНИЯ
   ============================================ */
.study-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.study-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.meta-item {}
.meta-key   { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 4px; }
.meta-value { font-size: .9rem; font-weight: 500; color: var(--text); }

.report-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.report-block-head {
  padding: 14px 18px;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--a-100);
  font-size: .83rem;
  font-weight: 700;
  color: var(--a-600);
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-block-head svg { width: 16px; height: 16px; }
.report-block-body { padding: 16px 18px; font-size: .9rem; line-height: 1.7; color: var(--text-body); white-space: pre-wrap; }

[data-theme="dark"] .report-block-head { background: hsl(210,40%,16%); border-color: hsl(210,40%,22%); }



/* ============================================
   ЧАТ / СООБЩЕНИЯ — Telegram-style messenger
   ============================================ */

/* Container: fixed height with scroll */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 300px;
  max-height: 520px;
  overflow-y: auto;
  padding: 16px 12px;
  scroll-behavior: smooth;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
@media (max-width: 768px) { .chat-messages { max-height: 380px; min-height: 200px; } }
@media (max-width: 480px) { .chat-messages { max-height: 300px; } }

/* Empty state */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px;
  color: var(--text-muted);
  font-size: .875rem;
  padding: 40px 20px;
  text-align: center;
}

/* Date separator */
.chat-date-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
}
.chat-date-sep::before,
.chat-date-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.chat-date-sep span {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Row: aligns bubble to left (other) or right (own) */
.message {
  display: flex;
  flex-direction: column;
  max-width: 72%;
  margin-bottom: 2px;
}
.message--own {
  align-self: flex-end;
  align-items: flex-end;
}
.message--other {
  align-self: flex-start;
  align-items: flex-start;
}

/* Consecutive messages from same sender — tighten gap */
.message + .message--own,
.message--own + .message--own { margin-top: 1px; }
.message + .message--other,
.message--other + .message--other { margin-top: 1px; }
.message--own + .message--other,
.message--other + .message--own { margin-top: 10px; }

/* Sender label (only for other person's messages) */
.message-sender {
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
  padding: 0 4px;
}
.message--own .message-sender { display: none; }

/* Bubble */
.message-bubble {
  padding: 8px 14px;
  border-radius: 18px;
  font-size: .875rem;
  line-height: 1.55;
  word-break: break-word;
  position: relative;
  transition: background var(--dur);
}

/* Other person — left side, neutral bubble */
.message--other .message-bubble {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-body);
  border-bottom-left-radius: 6px;
}

/* Own messages — right side, accent bubble */
.message--own .message-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 6px;
  border: none;
}

/* Images inside bubble */
.message-bubble img.chat-img {
  max-width: 260px;
  max-height: 200px;
  border-radius: 10px;
  display: block;
  margin-top: 4px;
  cursor: pointer;
}

/* Meta (time, edited) */
.message-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 0 4px;
}
.message-time {
  font-size: .68rem;
  color: var(--text-muted);
}
.message-edited {
  font-size: .68rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Actions on hover (edit button) */
.message-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity var(--dur);
}
.message:hover .message-actions { opacity: 1; }
.message-act-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .72rem;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  transition: background var(--dur), color var(--dur);
}
.message-act-btn:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

/* Chat input area */
.chat-input-area {
  margin-top: 12px;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 6px 6px 14px;
  transition: border-color var(--dur);
}
.chat-input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(210 88% 44% / .10);
}
.chat-input-row textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  min-height: 24px;
  max-height: 100px;
  padding: 4px 0;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--text);
  overflow-y: auto;
}
.chat-input-row textarea::placeholder { color: var(--text-muted); }
.chat-input-row textarea::-webkit-scrollbar { width: 4px; }
.chat-input-row textarea::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Attach image button inside input */
.chat-attach-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color var(--dur), background var(--dur);
}
.chat-attach-btn:hover { color: var(--accent); background: var(--accent-bg); }
.chat-attach-btn svg { width: 20px; height: 20px; }
.chat-attach-input { display: none; }

/* Send button */
.chat-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--dur), transform 80ms;
}
.chat-send-btn:hover { background: var(--accent-hover); }
.chat-send-btn:active { transform: scale(.92); }
.chat-send-btn:disabled { opacity: .4; cursor: not-allowed; }
.chat-send-btn svg { width: 18px; height: 18px; }

/* Edit-mode banner */
.chat-edit-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--accent-bg);
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--accent);
  border-bottom: none;
  font-size: .8rem;
  color: var(--accent);
  margin-bottom: -1px;
}
.chat-edit-banner strong { font-weight: 600; }
.chat-edit-cancel {
  margin-left: auto;
  background: none; border: none;
  cursor: pointer;
  color: var(--accent);
  opacity: .7;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
}
.chat-edit-cancel:hover { opacity: 1; }

/* Locked notice */
.chat-locked-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--n-50);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: 12px;
}
[data-theme="dark"] .chat-locked-notice { background: var(--n-800); }

/* Image preview (thumbnail in input) */
.chat-img-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--accent-bg);
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  font-size: .8rem;
  margin-bottom: -1px;
}
.chat-img-preview img {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: 6px;
}
.chat-img-preview-remove {
  margin-left: auto;
  background: none; border: none;
  cursor: pointer;
  color: var(--danger);
  opacity: .7;
  font-size: 1.1rem;
}
.chat-img-preview-remove:hover { opacity: 1; }

/* Scrollbar custom in chat */
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--n-200);
  border-radius: 3px;
}
[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb { background: var(--n-700); }




/* ============================================
   СТРАНИЦА ВХОДА
   ============================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--a-600) 0%, var(--a-400) 50%, hsl(196,80%,50%) 100%);
  padding: 20px;
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  animation: modal-in .2s var(--ease) both;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}
.auth-logo-icon {
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
}
.auth-logo-icon svg { width: 26px; height: 26px; fill: #fff; }
.auth-logo-text { font-size: 1.25rem; font-weight: 800; color: var(--text); }
.auth-title { font-size: 1.3rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.auth-sub   { font-size: .875rem; color: var(--text-muted); margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: .83rem; color: var(--text-muted); }



/* ============================================
   ЗАГРУЗКА ФАЙЛОВ
   ============================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  background: var(--bg);
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-bg); }
.upload-zone svg { width: 40px; height: 40px; color: var(--text-muted); margin: 0 auto 12px; }
.upload-zone p { color: var(--text-muted); font-size: .875rem; }
.upload-zone strong { color: var(--accent); }
.upload-zone small { font-size: .75rem; color: var(--text-muted); display: block; margin-top: 4px; }

.file-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.file-item-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--a-50); color: var(--a-500); }
.file-item-icon svg { width: 16px; height: 16px; }
.file-item-info { flex: 1; min-width: 0; }
.file-item-name { font-size: .83rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-meta { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.file-item-remove { flex-shrink: 0; cursor: pointer; color: var(--text-muted); background: none; border: none; padding: 4px; border-radius: 4px; }
.file-item-remove:hover { color: var(--danger); background: hsl(0,76%,94%); }
.file-item-remove svg { width: 14px; height: 14px; }



/* ============================================
   FILE UPLOADER — progress bar, status badges
   ============================================ */
.file-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 5px;
}
.file-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 200ms var(--ease);
}
.file-progress-fill--done {
  background: var(--success);
}

.file-item--done  { opacity: .85; }
.file-item--error { background: hsl(0,76%,98%); }
[data-theme="dark"] .file-item--error { background: hsl(0,30%,14%); }

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.file-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.file-status--done     { background: hsl(142,60%,94%); color: var(--success); }
.file-status--error    { background: hsl(0,76%,94%);   color: var(--danger); cursor: help; }
.file-status--uploading{ background: var(--accent-bg); color: var(--accent); }
[data-theme="dark"] .file-status--done  { background: hsl(142,30%,16%); }
[data-theme="dark"] .file-status--error { background: hsl(0,30%,16%); }



/* ============================================
   UPLOAD ZONE IMPROVEMENTS
   ============================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 32px 20px;
  text-align: center;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  cursor: pointer;
  user-select: none;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.upload-zone input[type=file] {
  display: none;
}

/* File list items */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-top: 8px;
  background: var(--bg);
  min-width: 0;
}
.file-item-icon { flex-shrink: 0; }
.file-item-info { flex: 1; min-width: 0; }
.file-item-name {
  font-size: .83rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-item-meta { font-size: .75rem; color: var(--text-muted); }
.file-item-actions { flex-shrink: 0; }
.file-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.file-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .2s;
}



/* ============================================================
   DESIGN IMPROVEMENTS — dashboard, cabinets, mobile
   ============================================================ */

/* ---- Sidebar overlay ---- */


/* ============================================
   NAV ITEM DANGER STATE
   ============================================ */
.nav-item--danger { color: var(--danger) !important; }
.nav-item--danger:hover { background: hsl(0 76% 96%) !important; color: var(--danger) !important; }
[data-theme="dark"] .nav-item--danger:hover { background: hsl(0 50% 14%) !important; }


/* ============================================
   TOAST — close button
   ============================================ */
.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: currentColor;
  opacity: .6;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0 0 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.toast-close:hover { opacity: 1; }

/* Toast entrance animation */
.toast--visible {
  transform: translateX(0);
  opacity: 1;
}

/* sidebar-overlay — defined in MOBILE LAYOUT FIXES section below */

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

.topbar-avatar:hover { border-color: var(--accent); text-decoration: none; }
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- burger-btn in topbar (alias for icon-btn) ---- */
/* ---- Card improvements ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }

/* ---- Study status badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge--draft     { background: hsl(220,14%,90%);  color: hsl(220,14%,34%); }
.badge--submitted { background: hsl(38,92%,90%);   color: hsl(38,70%,28%); }
.badge--in_review { background: hsl(210,100%,92%); color: hsl(210,88%,30%); }
.badge--completed { background: hsl(142,60%,90%);  color: hsl(142,60%,24%); }
.badge--urgent    { background: hsl(0,76%,92%);    color: hsl(0,60%,30%); }
[data-theme="dark"] .badge--draft     { background: hsl(220,14%,20%); color: hsl(220,10%,70%); }
[data-theme="dark"] .badge--submitted { background: hsl(38,40%,16%);  color: hsl(38,80%,70%); }
[data-theme="dark"] .badge--in_review { background: hsl(210,40%,18%); color: hsl(210,88%,70%); }
[data-theme="dark"] .badge--completed { background: hsl(142,30%,14%); color: hsl(142,60%,60%); }
[data-theme="dark"] .badge--urgent    { background: hsl(0,30%,16%);   color: hsl(0,76%,70%); }

/* ---- Data table improvements ---- */
.data-table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-body);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--dur) var(--ease); }
.data-table tbody tr:hover { background: var(--accent-bg); }

/* Mobile card-list for tables */
@media (max-width: 640px) {
  .data-table-wrap { border: none; border-radius: 0; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tbody tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 10px;
    padding: 4px 0;
    box-shadow: var(--shadow-sm);
  }
  .data-table tbody tr:hover { background: var(--bg-card); }
  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: .82rem;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: auto;
  }
}

/* ---- Form improvements ---- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: .9rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(210 88% 44% / .15);
}
.form-control::placeholder { color: var(--text-muted); }
.form-hint { font-size: .78rem; color: var(--text-muted); }
.form-error { font-size: .78rem; color: var(--danger); }

/* ---- Two-column form grid ---- */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* ---- Study layout page improvements ---- */
.study-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1024px) {
  .study-layout { grid-template-columns: 1fr; }
  .study-sidebar { display: contents; }
  .study-sidebar .card { order: -1; }
}

/* DICOM viewer */
#dicom-viewer {
  height: 560px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
@media (max-width: 768px) { #dicom-viewer { height: 380px; } }

/* ---- Upload zone polish ---- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  background: var(--bg);
}
.upload-zone:hover,
.upload-zone.drag {
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* ---- Dashboard quick actions ---- */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

/* ---- Notification / recent list items ---- */
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.list-item:last-child { border-bottom: none; }
.list-item-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.list-item-icon svg { width: 18px; height: 18px; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-sub { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.list-item-time { font-size: .72rem; color: var(--text-muted); flex-shrink: 0; margin-top: 2px; }

/* ---- Profile page ---- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar-edit {
  position: absolute;
  bottom: 0; right: 0;
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-card);
  cursor: pointer;
}
.profile-avatar-edit svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 2.5; }
.profile-meta { flex: 1; min-width: 0; }
.profile-name { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.profile-role { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }
.profile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---- Chat improvements ---- */
.chat-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}
/* --- Viewer iframe --- */
#viewer-container { border-radius: var(--r-md); overflow: hidden; }
#dicom-viewer { width: 100%; height: 600px; border: none; display: block; }
@media (max-width: 640px) { #dicom-viewer { height: 380px; } }

/* --- Форма заключения (report) --- */
.report-section { margin-bottom: 16px; }
.report-section-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.report-section-text {
  font-size: .9rem;
  color: var(--text-body);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* --- nav-item--danger: выход --- */
.nav-item--danger { color: var(--danger) !important; }
.nav-item--danger:hover { background: hsl(0 76% 52% / .08) !important; color: var(--danger) !important; }
.nav-item--danger svg { color: var(--danger); opacity: 1 !important; }

/* --- Search bar внутри карточки --- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 10px;
  height: 38px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsl(210 88% 44% / .12);
}
.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  min-width: 0;
  font-size: .875rem;
  color: var(--text-body);
}

/* --- Пагинация --- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-body);
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.pagination a:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* --- Priority badges --- */
.priority-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .04em;
}
.priority--stat   { background: hsl(0 76% 94%);  color: hsl(0 70% 36%);  }
.priority--urgent { background: hsl(38 92% 90%); color: hsl(38 80% 28%); }
.priority--normal { background: var(--n-50);      color: var(--text-muted); }
[data-theme="dark"] .priority--stat   { background: hsl(0 50% 18%);  color: hsl(0 80% 72%); }
[data-theme="dark"] .priority--urgent { background: hsl(38 50% 16%); color: hsl(38 90% 68%); }

/* --- Cards: нет лишнего padding у .card-body на мобильных --- */
@media (max-width: 480px) {
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }
}

/* --- Скролл-отступ для sticky topbar --- */
html { scroll-padding-top: 70px; }

/* --- Утилиты --- */
.mb-0  { margin-bottom: 0 !important; }
.mb-8  { margin-bottom: 8px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-20 { margin-bottom: 20px !important; }
.mb-24 { margin-bottom: 24px !important; }
.mb-32 { margin-bottom: 32px !important; }
.mt-8  { margin-top: 8px !important; }
.mt-12 { margin-top: 12px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-20 { margin-top: 20px !important; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-accent { color: var(--accent); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .78rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-100 { width: 100%; }
.min-w-0 { min-width: 0; }

/* ============================================================
   LANDING PAGE — index.php
   ============================================================ */

/* Screen-reader only utility */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Scroll-reveal ---- */
.reveal-pending { opacity: 0; transform: translateY(22px); }
.is-revealed   { opacity: 1; transform: none; transition: opacity .55s var(--ease), transform .55s var(--ease); }

/* ---- Container ---- */
.l-container {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 28px;
}
@media (max-width: 640px) { .l-container { padding-inline: 16px; } }



/* ============================================================
   NAV
   ============================================================ */
.landing-body { padding-top: 64px; }

.l-nav {
  position: fixed; top: 0; inset-inline: 0; z-index: 300;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow var(--dur) var(--ease), transform .3s var(--ease), background var(--dur) var(--ease);
  height: 64px;
}
.l-nav--scrolled {
  box-shadow: var(--shadow-md);
  background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
}
.l-nav--hidden { transform: translateY(-100%); }

.l-nav__inner {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 28px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
@media (max-width: 640px) { .l-nav__inner { padding-inline: 16px; gap: 16px; } }

.l-nav__logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  flex-shrink: 0;
}
.l-nav__logo:hover { text-decoration: none; }
.l-nav__logo-icon {
  width: 36px; height: 36px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.l-nav__logo-icon svg { width: 22px; height: 22px; }
.l-nav__logo-text { font-size: 1rem; font-weight: 700; color: var(--text); }

.l-nav__links {
  display: flex; align-items: center; gap: 4px;
  flex: 1;
}
.l-nav__links a {
  padding: 6px 12px;
  font-size: .875rem; font-weight: 500;
  color: var(--text-body);
  border-radius: var(--r-sm);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  text-decoration: none;
}
.l-nav__links a:hover { background: var(--accent-bg); color: var(--accent); text-decoration: none; }

.l-nav__actions {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}

@media (max-width: 860px) { .l-nav__links { display: none; } }

/* Burger */
.l-burger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  padding: 0;
}
.l-burger span {
  display: block; width: 16px; height: 1.5px;
  background: var(--text-body);
  border-radius: 2px;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.l-burger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.l-burger.is-open span:nth-child(2) { opacity: 0; }
.l-burger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
@media (max-width: 860px) {
  .l-burger { display: flex; }
  .l-nav__actions .btn { display: none; }
  .l-nav__actions .l-theme-toggle { display: flex; }
}

/* Mobile menu */
.l-mobile-menu {
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  padding: 16px 20px 24px;
}
.l-mobile-links { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.l-mobile-link {
  padding: 10px 12px;
  font-size: .95rem; font-weight: 500;
  color: var(--text-body);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: background var(--dur) var(--ease);
}
.l-mobile-link:hover { background: var(--accent-bg); color: var(--accent); }
.l-mobile-actions { display: flex; flex-direction: column; gap: 8px; }



/* ============================================================
   HERO
   ============================================================ */
.l-hero {
  position: relative;
  padding: 80px 0 96px;
  overflow: hidden;
}
@media (max-width: 768px) { .l-hero { padding: 56px 0 64px; } }

.l-hero__layout {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 64px;
  align-items: center;
}
@media (max-width: 1060px) { .l-hero__layout { grid-template-columns: 1fr 400px; gap: 40px; } }
@media (max-width: 860px) {
  .l-hero__layout { grid-template-columns: 1fr; gap: 48px; }
  .l-hero__visual { order: -1; }
}

/* Hero text */
.l-hero__badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 8px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: .78rem; font-weight: 600;
  border-radius: 20px;
  margin-bottom: 20px;
}
.l-hero__badge svg { width: 14px; height: 14px; }

.l-hero__title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: 20px;
}
.l-hero__title-accent {
  color: var(--accent);
  background: linear-gradient(135deg, var(--a-400), var(--a-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.l-hero__sub {
  font-size: 1.0625rem;
  color: var(--text-body);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 32px;
}

.l-hero__actions {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-bottom: 28px;
}

.l-hero__trust {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.l-trust-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .78rem; font-weight: 500;
  color: var(--text-body);
}
.l-trust-chip svg { width: 13px; height: 13px; color: var(--success); }

/* Hero visual */
.l-hero__visual {
  position: relative;
  height: 380px;
}
@media (max-width: 860px) { .l-hero__visual { height: 320px; } }

.l-hero__card {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.l-hero__card--main {
  inset-inline-start: 0; top: 0;
  width: 100%; max-width: 360px;
  padding: 18px;
}
@media (max-width: 860px) { .l-hero__card--main { max-width: 300px; } }

.l-hcard__header {
  display: flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 600; color: var(--text);
  margin-bottom: 12px;
}
.l-hcard__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.l-hcard__dot--blue { background: var(--accent); }
.l-hcard__status {
  margin-left: auto;
  font-size: .7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}
.l-hcard__status--done { background: hsl(142,60%,92%); color: var(--success); }
[data-theme="dark"] .l-hcard__status--done { background: hsl(142,30%,16%); }

.l-hcard__scan { border-radius: var(--r-sm); overflow: hidden; margin-bottom: 12px; }
.l-hcard__scan svg { width: 100%; height: auto; display: block; }

.l-hcard__meta { display: flex; gap: 16px; }
.l-hcard__meta-item { display: flex; flex-direction: column; gap: 1px; }
.l-hcard__meta-label { font-size: .68rem; color: var(--text-muted); }
.l-hcard__meta-val   { font-size: .8rem; font-weight: 600; color: var(--text); }

.l-hero__card--notif {
  inset-inline-end: 0; top: 40px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: .8rem; color: var(--accent);
  min-width: 180px;
  animation: l-float 3.5s ease-in-out infinite;
}
.l-hero__card--notif svg { width: 18px; height: 18px; flex-shrink: 0; }

.l-hero__card--stat {
  inset-inline-end: 30px; bottom: 20px;
  padding: 16px 20px;
  text-align: center;
}
.l-hero__stat-num {
  font-size: 2rem; font-weight: 800; color: var(--accent);
  line-height: 1; font-variant-numeric: tabular-nums;
}

@keyframes l-float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* Blobs */
.l-hero__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .18;
  pointer-events: none;
  z-index: -1;
}
.l-hero__blob--1 {
  width: 480px; height: 480px;
  background: var(--accent);
  inset-inline-end: -80px; top: -120px;
}
.l-hero__blob--2 {
  width: 320px; height: 320px;
  background: hsl(142,72%,50%);
  inset-inline-start: -80px; bottom: -80px;
}
[data-theme="dark"] .l-hero__blob { opacity: .10; }



/* ============================================================
   TRUST BAR
   ============================================================ */
.l-trust-bar {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  padding: 16px 0;
}
.l-trust-bar .l-container {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px;
}
.l-trust-bar__label {
  font-size: .78rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  flex-shrink: 0;
}
.l-trust-bar__list { display: flex; flex-wrap: wrap; gap: 8px; }
.l-trust-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid hsl(210,80%,88%);
  border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
[data-theme="dark"] .l-trust-badge { border-color: hsl(210,40%,28%); }



/* ============================================================
   SECTIONS
   ============================================================ */
.l-section { padding: 88px 0; }
.l-section--alt { background: var(--bg-raised); }
@media (max-width: 768px) { .l-section { padding: 60px 0; } }

.l-section__header {
  text-align: center;
  max-width: 600px;
  margin-inline: auto;
  margin-bottom: 56px;
}
.l-section__eyebrow {
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 10px;
}
.l-section__title {
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  font-weight: 800; color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 12px;
}
.l-section__title--left { text-align: left; }
.l-section__sub {
  font-size: .9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}



/* ============================================================
   HOW IT WORKS — STEPS
   ============================================================ */
.l-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
}
@media (max-width: 768px) {
  .l-steps { flex-direction: column; gap: 0; }
  .l-step__connector { display: none; }
}

.l-step {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 0 16px;
}
.l-step__number {
  font-size: .7rem; font-weight: 800;
  color: var(--accent); letter-spacing: .1em;
  margin-bottom: 16px;
  opacity: .7;
}
.l-step__icon {
  width: 64px; height: 64px;
  background: var(--accent-bg);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  margin-bottom: 20px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.l-step__icon svg { width: 28px; height: 28px; }
.l-step:hover .l-step__icon { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.l-step__title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.l-step__text  { font-size: .875rem; color: var(--text-body); line-height: 1.65; }

.l-step__connector {
  flex-shrink: 0;
  width: 48px; height: 2px;
  background: linear-gradient(90deg, var(--a-200), var(--a-400));
  margin-top: 48px;
  border-radius: 2px;
  opacity: .6;
}



/* ============================================================
   SERVICES GRID
   ============================================================ */
.l-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
@media (max-width: 640px) { .l-services-grid { grid-template-columns: 1fr; } }

.l-service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex; flex-direction: column;
  gap: 12px;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
  position: relative;
}
.l-service-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.l-service-card__icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
}
.l-service-card__icon svg { width: 24px; height: 24px; }

/* Per-colour variants */
.l-service-card--blue  .l-service-card__icon { background: var(--a-50);              color: var(--a-500); }
.l-service-card--purple .l-service-card__icon { background: hsl(260,60%,94%);        color: hsl(260,60%,48%); }
.l-service-card--green .l-service-card__icon  { background: hsl(142,60%,94%);        color: var(--success); }
.l-service-card--orange .l-service-card__icon { background: hsl(30,100%,94%);        color: hsl(30,80%,50%); }
.l-service-card--pink  .l-service-card__icon  { background: hsl(330,80%,95%);        color: hsl(330,60%,52%); }
.l-service-card--red   .l-service-card__icon  { background: hsl(0,76%,94%);          color: var(--danger); }
[data-theme="dark"] .l-service-card--blue   .l-service-card__icon { background: hsl(210,40%,18%); }
[data-theme="dark"] .l-service-card--purple .l-service-card__icon { background: hsl(260,30%,18%); }
[data-theme="dark"] .l-service-card--green  .l-service-card__icon { background: hsl(142,30%,14%); }
[data-theme="dark"] .l-service-card--orange .l-service-card__icon { background: hsl(30,40%,16%); }
[data-theme="dark"] .l-service-card--pink   .l-service-card__icon { background: hsl(330,30%,16%); }
[data-theme="dark"] .l-service-card--red    .l-service-card__icon { background: hsl(0,30%,16%); }

.l-service-card__title {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
}
.l-service-card__sub {
  font-size: .78rem; color: var(--text-muted); font-weight: 500;
  margin-top: -8px;
}
.l-service-card__desc {
  font-size: .875rem; color: var(--text-body); line-height: 1.6;
  flex: 1;
}
.l-service-card__link {
  font-size: .8rem; font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  align-self: flex-start;
  margin-top: 4px;
  transition: opacity var(--dur) var(--ease);
}
.l-service-card__link:hover { opacity: .75; text-decoration: none; }



/* ============================================================
   FEATURES GRID
   ============================================================ */
.l-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px 40px;
}
.l-feature-item {}
.l-feature-item__icon {
  width: 48px; height: 48px;
  background: var(--accent-bg);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  margin-bottom: 16px;
}
.l-feature-item__icon svg { width: 24px; height: 24px; }
.l-feature-item__title {
  font-size: .9375rem; font-weight: 700; color: var(--text);
  margin-bottom: 8px;
}
.l-feature-item__text {
  font-size: .875rem; color: var(--text-body); line-height: 1.65;
}



/* ============================================================
   STATS
   ============================================================ */
.l-stats-section {
  background: linear-gradient(135deg, var(--a-500), var(--a-700));
  padding: 64px 0;
}
.l-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  text-align: center;
}
.l-stat-item {
  display: flex; flex-direction: column; align-items: center;
}
.l-stat-item__num {
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  font-weight: 900;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.l-stat-item__suffix {
  font-size: 1.5rem; font-weight: 800;
  color: rgba(255,255,255,.7);
  margin-top: -8px;
}
.l-stat-item__label {
  font-size: .83rem; font-weight: 500;
  color: rgba(255,255,255,.75);
  margin-top: 8px;
  text-align: center;
}



/* ============================================================
   SPLIT SECTION (report preview)
   ============================================================ */
.l-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}
@media (max-width: 860px) {
  .l-split { grid-template-columns: 1fr; gap: 40px; }
}

.l-split__text {}
.l-split__desc {
  font-size: .9375rem; color: var(--text-body); line-height: 1.7;
  margin-bottom: 20px;
}
.l-check-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 10px;
}
.l-check-list li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: .875rem; color: var(--text-body); line-height: 1.5;
}
.l-check-list li::before {
  content: '';
  flex-shrink: 0;
  margin-top: 3px;
  width: 16px; height: 16px;
  background: var(--accent-bg);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' stroke='%231d6fa5' stroke-width='2' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='3 8 6 12 13 4'/%3E%3C/svg%3E");
  background-size: 12px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Report preview card */
.l-split__visual {}
.l-report-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.l-report-preview__bar {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 6px;
}
.l-report-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.l-report-dot--red    { background: hsl(0,70%,62%); }
.l-report-dot--yellow { background: hsl(38,80%,60%); }
.l-report-dot--green  { background: hsl(142,60%,52%); }
.l-report-preview__body { padding: 24px; }

.l-report-line {
  height: 8px; border-radius: 4px;
  background: var(--n-100);
  margin-bottom: 8px;
}
[data-theme="dark"] .l-report-line { background: var(--n-700); }
.l-report-line--title  { height: 12px; width: 60%; background: var(--n-200); }
[data-theme="dark"] .l-report-line--title { background: var(--n-600); }
.l-report-line--sub    { width: 40%; }
.l-report-line--short  { width: 55%; }
.l-report-line--med    { width: 75%; }
.l-report-line--sm-title { height: 7px; width: 80px; background: var(--n-200); }
.l-report-line--sm-sub   { height: 6px; width: 56px; margin-top: 4px; }

.l-report-section-label {
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: 6px;
}
.l-report-preview__sig {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}
.l-report-dot-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-bg);
  flex-shrink: 0;
}
.l-report-stamp { width: 40px; height: 40px; margin-left: auto; flex-shrink: 0; }
.l-report-stamp svg { width: 100%; height: 100%; }



/* ============================================================
   FAQ
   ============================================================ */
.l-faq {
  max-width: 720px;
  margin-inline: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.l-faq__item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
.l-faq__item.is-open { border-color: var(--accent); }

.l-faq__trigger {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  background: transparent; border: none; cursor: pointer;
  text-align: left;
  font-size: .9375rem; font-weight: 600; color: var(--text);
  transition: background var(--dur) var(--ease);
}
.l-faq__trigger:hover { background: var(--accent-bg); }
.l-faq__trigger span { flex: 1; }

.l-faq__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform .25s var(--ease);
}
.l-faq__icon-h { transition: opacity .25s var(--ease); }
.l-faq__item.is-open .l-faq__icon { transform: rotate(45deg); }

.l-faq__answer {
  padding: 0 20px 18px;
}
.l-faq__answer p {
  font-size: .875rem; color: var(--text-body); line-height: 1.7;
}



/* ============================================================
   CTA SECTION
   ============================================================ */
.l-cta-section { padding: 80px 0; }
.l-cta-inner {
  background: linear-gradient(135deg, var(--a-50) 0%, hsl(230,80%,97%) 100%);
  border: 1px solid var(--a-100);
  border-radius: 24px;
  padding: 64px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .l-cta-inner {
  background: linear-gradient(135deg, hsl(210,40%,14%), hsl(220,30%,12%));
  border-color: hsl(210,30%,24%);
}
.l-cta-inner__badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  font-size: .75rem; font-weight: 700;
  margin-bottom: 20px;
}
.l-cta-inner__badge svg { width: 12px; height: 12px; }
.l-cta-inner__title {
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  font-weight: 800; color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: 12px;
}
.l-cta-inner__sub {
  font-size: .9375rem; color: var(--text-muted);
  line-height: 1.65;
  max-width: 480px;
  margin-inline: auto;
  margin-bottom: 32px;
}
.l-cta-inner__actions {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 12px;
}
.l-cta-ghost { color: var(--text-muted); }
.l-cta-ghost:hover { color: var(--text); }

@media (max-width: 640px) {
  .l-cta-inner { padding: 40px 24px; }
}



/* ============================================================
   FOOTER
   ============================================================ */
.l-footer {
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  padding: 48px 0 28px;
}
.l-footer__top {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.l-footer__brand {
  flex: 0 0 260px;
}
.l-footer__brand-desc {
  font-size: .83rem; color: var(--text-muted); line-height: 1.6;
  margin-top: 10px;
}
.l-footer__links {
  display: flex; gap: 48px; flex-wrap: wrap; flex: 1;
}
.l-footer__col {
  display: flex; flex-direction: column; gap: 8px;
}
.l-footer__col-title {
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.l-footer__col a {
  font-size: .85rem; color: var(--text-body); text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.l-footer__col a:hover { color: var(--accent); text-decoration: none; }

.l-footer__bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  font-size: .78rem; color: var(--text-muted);
}



/* ============================================================
   BUTTON EXTRAS
   ============================================================ */
.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-body);
}
.btn--ghost:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.btn--sm { padding: 6px 14px; font-size: .8rem; }
.btn--lg { padding: 12px 24px; font-size: 1rem; gap: 8px; }

/* ============================================
   ADMIN CABINET SPECIFIC STYLES
   ============================================ */

/* Админ панель имеет акцент на управление пользователями и системой */

/* Административные карточки с предупреждениями */
.admin-warning-card {
  border-left: 4px solid var(--warning);
  background: hsl(38, 92%, 96%);
}

.admin-danger-card {
  border-left: 4px solid var(--danger);
  background: hsl(0, 76%, 96%);
}

/* Таблица пользователей - расширенная */
.users-table-actions {
  display: flex;
  gap: 8px;
}

.users-table-actions .btn {
  padding: 4px 10px;
  font-size: 0.75rem;
}

/* Статистика системы */
.system-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Быстрые действия администратора */
.admin-quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .admin-quick-actions {
    flex-direction: column;
  }

  .admin-quick-actions .btn {
    width: 100%;
  }
}
/* ============================================
   DOCTOR CABINET SPECIFIC STYLES
   ============================================ */

/* Кабинет врача фокусируется на исследованиях и отчётах */

/* Статус онлайн/оффлайн врача более заметен */
.doctor-status-banner {
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.doctor-status-banner.offline {
  background: var(--n-50);
}

/* Список исследований врача - компактный вид */
.doctor-studies-compact .study-card {
  padding: 12px 16px;
}

/* Приоритетные исследования выделяем */
.study-card--urgent {
  border-left: 4px solid var(--danger);
  background: hsl(0, 76%, 98%);
}

.study-card--high-priority {
  border-left: 4px solid var(--warning);
}

/* Быстрый доступ к вьюеру */
.quick-viewer-access {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
}

.quick-viewer-access .btn {
  box-shadow: var(--shadow-lg);
}

/* Статистика производительности врача */
.doctor-performance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .quick-viewer-access {
    bottom: 16px;
    right: 16px;
  }
}

/* ============================================
   TOPBAR TABS FOR STUDIES PAGE (DOCTOR)
   ============================================ */

/* Container for tabs in topbar */
.topbar-studies-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 8px;
}

.topbar-studies-tabs::-webkit-scrollbar {
  display: none;
}

/* Individual tab button */
.topbar-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
}

.topbar-tab:hover {
  background: var(--n-50);
  color: var(--text);
}

.topbar-tab.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

[data-theme="dark"] .topbar-tab:hover {
  background: var(--n-700);
}

[data-theme="dark"] .topbar-tab.active {
  background: hsl(210, 40%, 18%);
}

/* Badge inside tab */
.topbar-tab .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}

.topbar-tab.active .tab-badge {
  background: var(--accent);
}

.topbar-tab:not(.active) .tab-badge {
  background: var(--n-300);
}

[data-theme="dark"] .topbar-tab:not(.active) .tab-badge {
  background: var(--n-600);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .topbar-studies-tabs {
    padding: 0 4px;
  }
  
  .topbar-tab {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  
  .topbar-tab .tab-badge {
    min-width: 18px;
    height: 18px;
    font-size: 0.65rem;
    padding: 0 4px;
  }
}
/* ============================================
   PATIENT/CLINIC CABINET SPECIFIC STYLES
   ============================================ */

/* Кабинет пациента/клиники упрощён и понятен */

/* Упрощённая навигация */
.patient-welcome {
  background: linear-gradient(135deg, var(--accent-bg), var(--bg-card));
  border-radius: var(--r-lg);
  padding: 28px 24px;
  margin-bottom: 24px;
  text-align: center;
}

.patient-welcome h2 {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 8px;
}

.patient-welcome p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Большие понятные кнопки действий */
.patient-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.patient-action-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
  color: var(--text);
}

.patient-action-card:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.patient-action-card svg {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  color: var(--accent);
}

.patient-action-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.patient-action-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Упрощённый вид исследований */
.patient-study-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow var(--dur);
}

.patient-study-card:hover {
  box-shadow: var(--shadow-md);
}

.patient-study-card h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: var(--text);
}

.patient-study-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.patient-study-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 640px) {
  .patient-actions {
    grid-template-columns: 1fr;
  }
}
