:root {
  --ruk-brand-main: #1E40AF;
  --ruk-brand-deep: #1E3A8A;
  --ruk-brand-bright: #3B82F6;
  --ruk-brand-muted: #DBEAFE;
  
  --ruk-positive: #16A34A;
  --ruk-positive-bright: #4ADE80;
  --ruk-positive-soft: #DCFCE7;
  
  --ruk-caution: #EAB308;
  --ruk-caution-bright: #FACC15;
  --ruk-caution-soft: #FEF9C3;
  
  --ruk-negative: #DC2626;
  --ruk-negative-bright: #EF4444;
  --ruk-negative-soft: #FEE2E2;
  
  --ruk-neutral-info: #0EA5E9;
  --ruk-neutral-info-bright: #38BDF8;
  --ruk-neutral-info-soft: #E0F2FE;
  
  --ruk-canvas: #FFFFFF;
  --ruk-surface-1: #F9FAFB;
  --ruk-surface-2: #F3F4F6;
  --ruk-surface-3: #E5E7EB;
  --ruk-border-soft: #D1D5DB;
  --ruk-text-muted: #9CA3AF;
  --ruk-text-secondary: #6B7280;
  --ruk-text-tertiary: #4B5563;
  --ruk-text-primary: #374151;
  --ruk-text-heading: #1F2937;
  --ruk-ink: #111827;
  
  --ruk-mark-excellent: #16A34A;
  --ruk-mark-good: #3B82F6;
  --ruk-mark-satisfactory: #EAB308;
  --ruk-mark-poor: #DC2626;
  --ruk-mark-skip: #6B7280;
  
  --ruk-typeface: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Golos Text', 'Inter', BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ruk-size-micro: 0.75rem;
  --ruk-size-small: 0.875rem;
  --ruk-size-normal: 1rem;
  --ruk-size-medium: 1.125rem;
  --ruk-size-large: 1.25rem;
  --ruk-size-xlarge: 1.5rem;
  --ruk-size-xxlarge: 1.875rem;
  --ruk-size-huge: 2.25rem;
  
  --ruk-weight-regular: 400;
  --ruk-weight-book: 500;
  --ruk-weight-demi: 600;
  --ruk-weight-heavy: 700;
  
  --ruk-gap-xs: 0.25rem;
  --ruk-gap-sm: 0.5rem;
  --ruk-gap-md: 0.75rem;
  --ruk-gap-base: 1rem;
  --ruk-gap-lg: 1.25rem;
  --ruk-gap-xl: 1.5rem;
  --ruk-gap-2xl: 2rem;
  --ruk-gap-3xl: 2.5rem;
  --ruk-gap-4xl: 3rem;
  --ruk-gap-5xl: 4rem;
  
  --ruk-curve-xs: 0.25rem;
  --ruk-curve-sm: 0.5rem;
  --ruk-curve-md: 0.75rem;
  --ruk-curve-lg: 1rem;
  --ruk-curve-xl: 1.5rem;
  --ruk-curve-pill: 9999px;
  
  --ruk-elevation-1: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --ruk-elevation-2: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --ruk-elevation-3: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --ruk-elevation-4: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --ruk-elevation-5: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  --ruk-motion-quick: 150ms ease-in-out;
  --ruk-motion-normal: 250ms ease-in-out;
  --ruk-motion-smooth: 350ms ease-in-out;
  
  --ruk-layer-popup: 1000;
  --ruk-layer-fixed: 1020;
  --ruk-layer-header: 1030;
  --ruk-layer-overlay: 1040;
  --ruk-layer-dialog: 1050;
  --ruk-layer-float: 1060;
  --ruk-layer-hint: 1070;

  /* Фон страницы (подвал визуально стыкуется с сайдбаром) */
  --ruk-page-bg: #f2f2f7;

  /* Сетка брейкпоинтов как в Tailwind: sm 640 · md 768 · lg 1024 · xl 1280 · 2xl 1536 */
  --ruk-bp-sm: 640px;
  --ruk-bp-md: 768px;
  --ruk-bp-lg: 1024px;
  --ruk-bp-xl: 1280px;
  --ruk-bp-2xl: 1536px;
}

[data-appearance="inverted"] {
  --ruk-canvas: #1F2937;
  --ruk-surface-1: #111827;
  --ruk-surface-2: #1F2937;
  --ruk-surface-3: #374151;
  --ruk-border-soft: #4B5563;
  --ruk-text-muted: #6B7280;
  --ruk-text-secondary: #9CA3AF;
  --ruk-text-tertiary: #D1D5DB;
  --ruk-text-primary: #E5E7EB;
  --ruk-text-heading: #F3F4F6;
  --ruk-ink: #F9FAFB;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--ruk-typeface);
  font-size: var(--ruk-size-normal);
  font-weight: var(--ruk-weight-regular);
  line-height: 1.6;
  color: var(--ruk-text-heading);
  background-color: var(--ruk-page-bg, #f2f2f7);
}

a {
  color: var(--ruk-brand-main);
  text-decoration: none;
  transition: color var(--ruk-motion-quick);
}

a:hover {
  color: var(--ruk-brand-deep);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--ruk-weight-heavy);
  line-height: 1.2;
  color: var(--ruk-ink);
  margin-bottom: var(--ruk-gap-base);
}

h1 {
  font-size: var(--ruk-size-huge);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--ruk-size-xxlarge);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--ruk-size-xlarge);
}

h4 {
  font-size: var(--ruk-size-large);
}

h5 {
  font-size: var(--ruk-size-medium);
}

h6 {
  font-size: var(--ruk-size-normal);
}

p {
  margin-bottom: var(--ruk-gap-base);
}

.text-xs { font-size: var(--ruk-size-micro); }
.text-sm { font-size: var(--ruk-size-small); }
.text-base { font-size: var(--ruk-size-normal); }
.text-lg { font-size: var(--ruk-size-medium); }
.text-xl { font-size: var(--ruk-size-large); }
.text-2xl { font-size: var(--ruk-size-xlarge); }
.text-3xl { font-size: var(--ruk-size-xxlarge); }

.font-normal { font-weight: var(--ruk-weight-regular); }
.font-medium { font-weight: var(--ruk-weight-book); }
.font-semibold { font-weight: var(--ruk-weight-demi); }
.font-bold { font-weight: var(--ruk-weight-heavy); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--ruk-gap-xl);
}

.container-fluid {
  width: 100%;
  padding: 0 var(--ruk-gap-xl);
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Полоса под шапкой: тянется между header и footer, сайдбар на всю её высоту */
.app-layout-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.app-layout-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--ruk-gap-2xl);
}

.main-content {
  flex: 1;
  padding: var(--ruk-gap-2xl) 0;
}

.grid {
  display: grid;
  gap: var(--ruk-gap-xl);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--ruk-gap-xs); }
.gap-2 { gap: var(--ruk-gap-sm); }
.gap-3 { gap: var(--ruk-gap-md); }
.gap-4 { gap: var(--ruk-gap-base); }
.gap-6 { gap: var(--ruk-gap-xl); }
.gap-8 { gap: var(--ruk-gap-2xl); }

.header {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--ruk-ink);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
  position: sticky;
  top: 0;
  /* Выше sidebar-drawer и затемнения, ниже модалок (--ruk-layer-dialog 1050) */
  z-index: 1048;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ruk-gap-md) var(--ruk-gap-xl);
  max-width: 1440px;
  margin: 0 auto;
  min-height: 56px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-sm);
  font-size: var(--ruk-size-normal);
  font-weight: var(--ruk-weight-heavy);
  color: var(--ruk-ink);
}

.navbar-brand:hover {
  color: var(--ruk-ink);
  text-decoration: none;
  opacity: 0.7;
}

.navbar-cluster {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-sm);
  min-width: 0;
  flex: 1 1 auto;
}

.navbar-actions {
  flex-shrink: 0;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ruk-ink);
  cursor: pointer;
  transition: background var(--ruk-motion-quick);
}

.sidebar-toggle:hover {
  background: rgba(60, 60, 67, 0.08);
}

.sidebar-toggle:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.35);
  outline-offset: 1px;
}

.sidebar-toggle__label {
  display: none;
}

.navbar-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--ruk-curve-sm);
  background: var(--ruk-canvas);
  padding: var(--ruk-gap-sm);
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-xl);
  list-style: none;
}

.navbar-link {
  color: var(--ruk-text-primary);
  font-weight: var(--ruk-weight-book);
  font-size: var(--ruk-size-small);
  padding: 6px 12px;
  border-radius: 8px;
  transition: all var(--ruk-motion-quick);
}

.navbar-link:hover {
  background: rgba(60, 60, 67, 0.06);
  color: var(--ruk-ink);
  text-decoration: none;
}

.navbar-link.active {
  background: rgba(0, 122, 255, 0.1);
  color: #007AFF;
  font-weight: var(--ruk-weight-demi);
}

/* Метка непрочитанных в шапке (Inertia AppLayout) */
.app-layout-nav-badge {
  margin-left: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Inertia AppLayout: навигация в левой колонке (не верхняя панель) */
.app-layout-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
}

.app-layout-sidebar {
  box-sizing: border-box;
  width: 260px;
  flex-shrink: 0;
  background: #ffffff;
  padding: var(--ruk-gap-md) var(--ruk-gap-sm);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 0.5px solid rgba(60, 60, 67, 0.12);
}

.app-layout-sidebar-brand {
  padding: 4px 8px 12px;
  margin-bottom: var(--ruk-gap-sm);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.1);
}

.app-layout-sidebar-brand .navbar-brand {
  display: inline-flex;
  font-size: var(--ruk-size-medium);
}

.app-layout-sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.app-layout-sidebar .sidebar-nav {
  padding-bottom: var(--ruk-gap-md);
}

.app-layout-sidebar .sidebar-link {
  width: 100%;
  box-sizing: border-box;
}

.app-layout-sidebar-link-text {
  flex: 1;
  min-width: 0;
}

.app-layout-sidebar .app-layout-nav-badge {
  margin-left: auto;
  flex-shrink: 0;
}

.app-layout-sidebar-footer {
  flex-shrink: 0;
  padding-top: var(--ruk-gap-md);
  border-top: 0.5px solid rgba(60, 60, 67, 0.1);
}

.app-layout-sidebar-user {
  font-size: var(--ruk-size-small);
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-ink);
  margin-bottom: var(--ruk-gap-sm);
  padding: 0 12px;
  line-height: 1.35;
  word-break: break-word;
}

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

@media (max-width: 768px) {
  .app-layout-shell {
    flex-direction: column;
  }

  .app-layout-sidebar {
    position: relative;
    height: auto;
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
  }

  .app-layout-sidebar-scroll {
    max-height: min(50vh, 320px);
  }
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-sm);
  max-width: 100%;
  min-width: 0;
  padding: 4px 10px 4px 4px;
  background: rgba(60, 60, 67, 0.05);
  border-radius: var(--ruk-curve-pill);
  cursor: pointer;
  transition: all var(--ruk-motion-quick);
  position: relative;
  font-size: var(--ruk-size-small);
  color: var(--ruk-ink);
}

.navbar-user__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-user:hover {
  background: rgba(60, 60, 67, 0.1);
}

.navbar-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--ruk-curve-pill);
  border: 2px solid var(--ruk-canvas);
  object-fit: cover;
}

.sidebar {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 260px;
  background-color: #ffffff;
  border-right: 0.5px solid rgba(60, 60, 67, 0.12);
  padding: var(--ruk-gap-sm);
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

/* Скролл только у меню, если пунктов много; aside растягивается на всю высоту контента */
.sidebar-inner {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-item {
  margin-bottom: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-md);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ruk-text-primary);
  font-weight: var(--ruk-weight-regular);
  font-size: var(--ruk-size-small);
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ruk-ink);
  text-decoration: none;
  transform: none;
}

.sidebar-link.active {
  background: rgba(0, 122, 255, 0.1);
  color: #007AFF;
  font-weight: var(--ruk-weight-demi);
  box-shadow: none;
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

.sidebar-section {
  margin-top: var(--ruk-gap-2xl);
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: var(--ruk-weight-regular);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ruk-text-muted);
  margin-bottom: 4px;
  margin-top: 16px;
  padding: 0 12px;
}

.card {
  background: var(--ruk-canvas);
  border-radius: 12px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  border: none;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: none;
}

.card-header {
  padding: var(--ruk-gap-lg) var(--ruk-gap-xl);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.1);
  background: rgba(249, 249, 249, 0.8);
}

.card-title {
  font-size: var(--ruk-size-medium);
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-ink);
  margin: 0;
}

.card-subtitle {
  font-size: var(--ruk-size-small);
  color: var(--ruk-text-tertiary);
  margin-top: var(--ruk-gap-xs);
}

.card-body {
  padding: var(--ruk-gap-xl);
}

.card-footer {
  padding: var(--ruk-gap-base) var(--ruk-gap-xl);
  border-top: 0.5px solid rgba(60, 60, 67, 0.1);
  background: rgba(249, 249, 249, 0.8);
}

.stat-card {
  background: var(--ruk-canvas);
  border-radius: 12px;
  padding: var(--ruk-gap-xl);
  border: none;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--ruk-gap-base);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ruk-size-xlarge);
}

.stat-card-icon.primary { background: var(--ruk-brand-muted); color: var(--ruk-brand-main); }
.stat-card-icon.success { background: var(--ruk-positive-soft); color: var(--ruk-positive); }
.stat-card-icon.warning { background: var(--ruk-caution-soft); color: var(--ruk-caution); }
.stat-card-icon.danger { background: var(--ruk-negative-soft); color: var(--ruk-negative); }
.stat-card-icon.info { background: rgba(0, 122, 255, 0.1); color: var(--ruk-brand-main); }

.stat-card-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.stat-card-value {
  font-size: var(--ruk-size-xxlarge);
  font-weight: var(--ruk-weight-heavy);
  color: var(--ruk-ink);
  line-height: 1;
}

.stat-card-label {
  font-size: var(--ruk-size-small);
  color: var(--ruk-text-tertiary);
  margin-top: var(--ruk-gap-sm);
}

.stat-card-trend {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-sm);
  margin-top: var(--ruk-gap-md);
  font-size: var(--ruk-size-small);
  font-weight: var(--ruk-weight-book);
}

.stat-card-trend.up { color: var(--ruk-positive); }
.stat-card-trend.down { color: var(--ruk-negative); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ruk-gap-sm);
  padding: 8px 16px;
  font-size: var(--ruk-size-normal);
  font-weight: var(--ruk-weight-book);
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(0.95);
  transform: none;
  text-decoration: none;
}

.btn:active {
  filter: brightness(0.9);
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: #007AFF;
  color: var(--ruk-canvas);
}

.btn-primary:hover {
  background: #0071e3;
  color: var(--ruk-canvas);
}

.btn-success {
  background: var(--ruk-positive);
  color: var(--ruk-canvas);
}

.btn-success:hover {
  background: #15803D;
  color: var(--ruk-canvas);
}

.btn-warning {
  background: var(--ruk-caution);
  color: var(--ruk-ink);
}

.btn-warning:hover {
  background: #CA8A04;
}

.btn-danger {
  background: var(--ruk-negative);
  color: var(--ruk-canvas);
}

.btn-danger:hover {
  background: #B91C1C;
  color: var(--ruk-canvas);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #007AFF;
  color: #007AFF;
}

.btn-outline:hover {
  background: #007AFF;
  color: var(--ruk-canvas);
}

.btn-ghost {
  background: transparent;
  color: var(--ruk-text-primary);
}

.btn-ghost:hover {
  background: var(--ruk-surface-2);
}

.btn-sm {
  padding: var(--ruk-gap-sm) var(--ruk-gap-base);
  font-size: var(--ruk-size-small);
}

.btn-lg {
  padding: var(--ruk-gap-base) var(--ruk-gap-2xl);
  font-size: var(--ruk-size-medium);
}

.btn-icon {
  padding: var(--ruk-gap-md);
  border-radius: var(--ruk-curve-md);
}

.form-group {
  margin-bottom: var(--ruk-gap-lg);
}

.form-label {
  display: block;
  font-size: var(--ruk-size-small);
  font-weight: var(--ruk-weight-book);
  color: var(--ruk-text-primary);
  margin-bottom: var(--ruk-gap-sm);
}

.form-label-required::after {
  content: '*';
  color: var(--ruk-negative);
  margin-left: var(--ruk-gap-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--ruk-size-normal);
  font-family: inherit;
  border: 0.5px solid rgba(60, 60, 67, 0.2);
  border-radius: 10px;
  background: var(--ruk-canvas);
  color: var(--ruk-ink);
  transition: all 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #007AFF;
  box-shadow: 0 0 0 3.5px rgba(0, 122, 255, 0.2);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--ruk-surface-2);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--ruk-negative);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  box-shadow: 0 0 0 3px var(--ruk-negative-soft);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-help {
  display: block;
  font-size: var(--ruk-size-small);
  color: var(--ruk-text-tertiary);
  margin-top: var(--ruk-gap-sm);
}

.form-error {
  display: block;
  font-size: var(--ruk-size-small);
  color: var(--ruk-negative);
  margin-top: var(--ruk-gap-sm);
}

.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-md);
  cursor: pointer;
}

.form-checkbox input,
.form-radio input {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--ruk-brand-main);
}

.file-upload {
  border: 1.5px dashed rgba(60, 60, 67, 0.2);
  border-radius: 12px;
  padding: var(--ruk-gap-2xl);
  text-align: center;
  background: rgba(249, 249, 249, 0.5);
  transition: all 0.15s ease;
  cursor: pointer;
}

.file-upload:hover {
  border-color: #007AFF;
  background: rgba(0, 122, 255, 0.04);
}

.file-upload-icon {
  font-size: var(--ruk-size-huge);
  color: var(--ruk-text-muted);
  margin-bottom: var(--ruk-gap-base);
}

/* Иконки монохром (ДЗ учителя: скрепка / корзина и т.п.) — светлая тема чёрный SVG, тёмная инверсия */
.hw-mono-icon {
  width: auto;
  height: 1.15em;
  max-height: none;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}

.hw-mono-icon--btn {
  width: 18px;
  height: 18px;
}

.hw-mono-icon--empty {
  width: 48px;
  height: 48px;
  opacity: 0.42;
}

.hw-mono-icon--xl {
  width: 40px;
  height: 40px;
}

.hw-mono-icon-upload-wrap {
  margin-bottom: var(--ruk-gap-base);
  display: flex;
  justify-content: center;
}

html[data-theme='dark'] .hw-mono-icon {
  filter: brightness(0) invert(1);
  opacity: 0.94;
}

html[data-theme='dark'] .hw-mono-icon--empty {
  opacity: 0.5;
}

.file-upload-text {
  font-size: var(--ruk-size-normal);
  color: var(--ruk-text-primary);
}

.file-upload-hint {
  font-size: var(--ruk-size-small);
  color: var(--ruk-text-secondary);
  margin-top: var(--ruk-gap-sm);
}

.table-wrapper {
  overflow-x: auto;
  background: var(--ruk-canvas);
  border-radius: 12px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  border: none;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ruk-size-small);
}

.table thead {
  background: rgba(249, 249, 249, 0.9);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
}

.table th {
  padding: var(--ruk-gap-base) var(--ruk-gap-lg);
  text-align: left;
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-ink);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--ruk-surface-2);
  z-index: 10;
}

.table td {
  padding: var(--ruk-gap-base) var(--ruk-gap-lg);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
  color: var(--ruk-text-primary);
}

.table tbody tr {
  transition: background var(--ruk-motion-quick);
}

.table tbody tr:hover {
  background: var(--ruk-surface-1);
}

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

.table th:first-child,
.table td:first-child {
  position: sticky;
  left: 0;
  background: var(--ruk-canvas);
  z-index: 11;
}

.table thead th:first-child {
  background: var(--ruk-surface-2);
  z-index: 12;
}

.table tbody tr:hover td:first-child {
  background: var(--ruk-surface-1);
}

.journal-table {
  font-size: var(--ruk-size-small);
}

.journal-table th {
  font-size: var(--ruk-size-micro);
  text-align: center;
  padding: var(--ruk-gap-md);
}

.journal-table td {
  text-align: center;
  padding: var(--ruk-gap-md);
  min-width: 60px;
}

.journal-table .student-name {
  text-align: left;
  font-weight: var(--ruk-weight-book);
  min-width: 200px;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grade-cell {
  cursor: pointer;
  position: relative;
  font-weight: var(--ruk-weight-demi);
  border-radius: var(--ruk-curve-sm);
  transition: all var(--ruk-motion-quick);
}

.grade-cell:hover {
  transform: scale(1.1);
  box-shadow: var(--ruk-elevation-2);
  z-index: 1;
}

.grade-cell.empty {
  color: var(--ruk-text-muted);
}

.grade-cell.grade-5 {
  color: var(--ruk-mark-excellent);
  background: var(--ruk-positive-soft);
}

.grade-cell.grade-4 {
  color: var(--ruk-mark-good);
  background: var(--ruk-neutral-info-soft);
}

.grade-cell.grade-3 {
  color: var(--ruk-mark-satisfactory);
  background: var(--ruk-caution-soft);
}

.grade-cell.grade-2 {
  color: var(--ruk-mark-poor);
  background: var(--ruk-negative-soft);
}

.grade-cell.absent {
  color: var(--ruk-mark-skip);
  background: var(--ruk-surface-2);
}

.average-grade {
  font-weight: var(--ruk-weight-heavy);
  color: #007AFF;
  background: rgba(0, 122, 255, 0.1);
  border-radius: 6px;
  padding: var(--ruk-gap-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--ruk-gap-sm);
  padding: var(--ruk-gap-xs) var(--ruk-gap-md);
  font-size: var(--ruk-size-micro);
  font-weight: var(--ruk-weight-book);
  border-radius: var(--ruk-curve-pill);
  white-space: nowrap;
}

.badge-primary {
  background: var(--ruk-brand-muted);
  color: var(--ruk-brand-main);
}

.badge-success {
  background: var(--ruk-positive-soft);
  color: var(--ruk-positive);
}

.badge-warning {
  background: var(--ruk-caution-soft);
  color: var(--ruk-caution);
}

.badge-danger {
  background: var(--ruk-negative-soft);
  color: var(--ruk-negative);
}

.badge-info {
  background: var(--ruk-neutral-info-soft);
  color: var(--ruk-neutral-info);
}

.badge-gray {
  background: var(--ruk-surface-3);
  color: var(--ruk-text-primary);
}

.alert {
  padding: var(--ruk-gap-base) var(--ruk-gap-lg);
  border-radius: 12px;
  border-left: none;
  margin-bottom: var(--ruk-gap-base);
  display: flex;
  align-items: flex-start;
  gap: var(--ruk-gap-md);
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: var(--ruk-weight-demi);
  margin-bottom: var(--ruk-gap-sm);
}

.alert-success {
  background: var(--ruk-positive-soft);
  border-color: var(--ruk-positive);
  color: var(--ruk-positive);
}

.alert-warning {
  background: var(--ruk-caution-soft);
  border-color: var(--ruk-caution);
  color: #92400E;
}

.alert-danger {
  background: var(--ruk-negative-soft);
  border-color: var(--ruk-negative);
  color: var(--ruk-negative);
}

.alert-info {
  background: var(--ruk-neutral-info-soft);
  border-color: var(--ruk-neutral-info);
  color: var(--ruk-neutral-info);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--ruk-layer-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--ruk-gap-base);
  padding-left: max(var(--ruk-gap-base), env(safe-area-inset-left));
  padding-right: max(var(--ruk-gap-base), env(safe-area-inset-right));
  padding-bottom: max(var(--ruk-gap-base), env(safe-area-inset-bottom));
  box-sizing: border-box;
  animation: rukFadeIn var(--ruk-motion-normal);
}

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

.modal {
  background: var(--ruk-canvas);
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 100%;
  min-width: 0;
  max-height: 90vh;
  max-height: min(90vh, 90dvh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: rukSlideUp var(--ruk-motion-normal);
  box-sizing: border-box;
}

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

.modal-header {
  padding: var(--ruk-gap-xl);
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--ruk-size-large);
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-ink);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--ruk-curve-sm);
  border: none;
  background: var(--ruk-surface-2);
  color: var(--ruk-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ruk-motion-quick);
}

.modal-close:hover {
  background: var(--ruk-surface-3);
  color: var(--ruk-ink);
}

.modal-body {
  padding: var(--ruk-gap-xl);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--ruk-gap-lg) var(--ruk-gap-xl);
  border-top: 0.5px solid rgba(60, 60, 67, 0.12);
  display: flex;
  gap: var(--ruk-gap-md);
  justify-content: flex-end;
  background: rgba(249, 249, 249, 0.8);
}

.schedule-card {
  background: var(--ruk-canvas);
  border-radius: 12px;
  padding: var(--ruk-gap-lg);
  border-left: 4px solid;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: all 0.15s ease;
  margin-bottom: var(--ruk-gap-base);
}

.schedule-card:hover {
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: none;
}

.schedule-card.lecture {
  border-color: var(--ruk-brand-main);
}

.schedule-card.practice {
  border-color: var(--ruk-positive);
}

.schedule-card.lab {
  border-color: var(--ruk-caution);
}

.schedule-card.exam {
  border-color: var(--ruk-negative);
}

.schedule-card.current {
  background: rgba(0, 122, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(0, 122, 255, 0.15), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.schedule-time {
  font-size: var(--ruk-size-medium);
  font-weight: var(--ruk-weight-heavy);
  color: var(--ruk-ink);
  margin-bottom: var(--ruk-gap-sm);
}

.schedule-subject {
  font-size: var(--ruk-size-normal);
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-text-heading);
  margin-bottom: var(--ruk-gap-sm);
}

.schedule-details {
  display: flex;
  gap: var(--ruk-gap-base);
  font-size: var(--ruk-size-small);
  color: var(--ruk-text-tertiary);
}

.schedule-detail {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-sm);
}

.widget {
  background: var(--ruk-canvas);
  border-radius: 12px;
  padding: var(--ruk-gap-xl);
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  border: none;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--ruk-gap-lg);
}

.widget-title {
  font-size: var(--ruk-size-medium);
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-ink);
  margin: 0;
}

.widget-action {
  font-size: var(--ruk-size-small);
  color: var(--ruk-brand-main);
  cursor: pointer;
  transition: color var(--ruk-motion-quick);
}

.widget-action:hover {
  color: var(--ruk-brand-deep);
  text-decoration: underline;
}

/* Студент /student/homework: без перекрытий, на ПК — две колонки с выравниванием по верху */
.st-homework-cards {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 1024px) {
  .st-homework-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .st-homework-cards .card {
    min-width: 0;
  }
}

.progress {
  width: 100%;
  height: 8px;
  background: var(--ruk-surface-3);
  border-radius: var(--ruk-curve-pill);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #007AFF;
  border-radius: var(--ruk-curve-pill);
  transition: width var(--ruk-motion-smooth);
}

.progress-bar.success {
  background: linear-gradient(to right, var(--ruk-positive), var(--ruk-positive-bright));
}

.progress-bar.warning {
  background: linear-gradient(to right, var(--ruk-caution), var(--ruk-caution-bright));
}

.progress-bar.danger {
  background: linear-gradient(to right, var(--ruk-negative), var(--ruk-negative-bright));
}

.tabs {
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
  margin-bottom: var(--ruk-gap-xl);
}

.tabs-list {
  display: flex;
  gap: var(--ruk-gap-sm);
  list-style: none;
}

.tab-item {
  padding: var(--ruk-gap-md) var(--ruk-gap-lg);
  font-weight: var(--ruk-weight-book);
  color: var(--ruk-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-item:hover {
  color: #007AFF;
}

.tab-item.active {
  color: #007AFF;
  border-bottom-color: #007AFF;
  font-weight: var(--ruk-weight-demi);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ruk-gap-sm);
  margin-top: var(--ruk-gap-xl);
}

.pagination-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: var(--ruk-weight-book);
  color: var(--ruk-text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  font-size: var(--ruk-size-small);
}

.pagination-item:hover {
  background: rgba(60, 60, 67, 0.06);
}

.pagination-item.active {
  background: #007AFF;
  color: var(--ruk-canvas);
}

.pagination-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--ruk-gap-sm);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  border: none;
  min-width: 200px;
  z-index: var(--ruk-layer-popup);
  overflow: hidden;
  animation: rukDropIn var(--ruk-motion-quick);
}

@keyframes rukDropIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--ruk-gap-md);
  padding: var(--ruk-gap-md) var(--ruk-gap-base);
  color: var(--ruk-text-primary);
  cursor: pointer;
  transition: background var(--ruk-motion-quick);
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--ruk-surface-2);
  text-decoration: none;
}

/* Меню пользователя в шапке: кнопки в ряд, ширина по содержимому */
.dropdown-menu--user-actions {
  display: inline-flex;
  flex-flow: row nowrap;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  width: max-content;
  max-width: min(calc(100vw - 24px), 420px);
  padding: 4px;
  background: var(--ruk-surface-1);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.dropdown-menu--user-actions .dropdown-item {
  flex: 0 0 auto;
  padding: 8px 14px;
  white-space: nowrap;
  border-radius: 8px;
}

.dropdown-divider {
  height: 1px;
  background: var(--ruk-surface-3);
  margin: var(--ruk-gap-sm) 0;
}

.toast-container {
  position: fixed;
  top: var(--ruk-gap-xl);
  right: var(--ruk-gap-xl);
  z-index: var(--ruk-layer-hint);
  display: flex;
  flex-direction: column;
  gap: var(--ruk-gap-md);
}

.toast {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  padding: var(--ruk-gap-base) var(--ruk-gap-lg);
  min-width: 320px;
  display: flex;
  align-items: flex-start;
  gap: var(--ruk-gap-md);
  border-left: none;
  animation: rukSlideInRight var(--ruk-motion-normal);
}

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

.toast-success { border-color: var(--ruk-positive); }
.toast-warning { border-color: var(--ruk-caution); }
.toast-danger { border-color: var(--ruk-negative); }
.toast-info { border-color: var(--ruk-neutral-info); }

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-ink);
  margin-bottom: var(--ruk-gap-xs);
}

.toast-message {
  font-size: var(--ruk-size-small);
  color: var(--ruk-text-tertiary);
}

.ruk-toast-list-enter-active,
.ruk-toast-list-leave-active {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.ruk-toast-list-enter-from,
.ruk-toast-list-leave-to {
  opacity: 0;
  transform: translateX(24px);
}

@media (max-width: 640px) {
  .toast-container {
    left: var(--ruk-gap-md);
    right: var(--ruk-gap-md);
    top: max(var(--ruk-gap-md), env(safe-area-inset-top));
  }

  .toast {
    min-width: 0;
    width: 100%;
  }
}

html[data-theme='dark'] .toast {
  background: var(--ruk-surface-2);
  border: 1px solid var(--ruk-border-soft);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

html[data-theme='dark'] .toast-message {
  color: var(--ruk-text-primary);
}

.avatar {
  border-radius: var(--ruk-curve-pill);
  object-fit: cover;
  background: var(--ruk-surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-canvas);
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--ruk-size-small); }
.avatar-md { width: 48px; height: 48px; font-size: var(--ruk-size-medium); }
.avatar-lg { width: 80px; height: 80px; font-size: var(--ruk-size-xlarge); }
.avatar-xl { width: 120px; height: 120px; font-size: var(--ruk-size-xxlarge); }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--ruk-surface-3);
  border-top-color: var(--ruk-brand-main);
  border-radius: var(--ruk-curve-pill);
  animation: rukRotate 1s linear infinite;
}

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

.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.spinner-lg { width: 60px; height: 60px; border-width: 6px; }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.empty-state {
  text-align: center;
  padding: var(--ruk-gap-4xl) var(--ruk-gap-xl);
}

.empty-state-icon {
  font-size: var(--ruk-size-huge);
  color: var(--ruk-text-muted);
  margin-bottom: var(--ruk-gap-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  opacity: 0.9;
}

.empty-state-title {
  font-size: var(--ruk-size-large);
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-ink);
  margin-bottom: var(--ruk-gap-md);
}

.empty-state-text {
  font-size: var(--ruk-size-normal);
  color: var(--ruk-text-tertiary);
  margin-bottom: var(--ruk-gap-xl);
}

/* Auth (login): фото fon + тёмная вуаль + стеклянная карточка */
.auth-layout {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.auth-layout__bg {
  position: fixed;
  inset: 0;
  background: url('/images/login-brand.jpg') center / cover no-repeat;
  background-color: #1a1f2e;
}

.auth-layout__veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    105deg,
    rgba(15, 23, 42, 0.52) 0%,
    rgba(15, 23, 42, 0.38) 45%,
    rgba(15, 23, 42, 0.42) 100%
  );
}

.auth-layout__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(300px, 440px);
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  gap: clamp(1.5rem, 5vw, 3.5rem);
}

.auth-layout__intro {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 4vw, 3rem);
}

.auth-layout__intro-inner {
  max-width: 28rem;
  margin: 0 auto;
  text-align: center;
}

.auth-layout__brand-frame {
  display: block;
  width: fit-content;
  max-width: min(100%, 380px);
  margin: 0 auto 1.75rem;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: saturate(140%) blur(18px);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset,
    0 8px 24px rgba(15, 23, 42, 0.14);
}

.auth-layout__brand-svg {
  width: min(100%, 340px);
  height: auto;
  display: block;
  margin: 0;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.18));
  opacity: 1;
}

.auth-layout__intro-title {
  margin: 0 0 0.85rem;
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.25;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.auth-layout__intro-text {
  margin: 0;
  font-size: clamp(0.92rem, 1.45vw, 1.02rem);
  line-height: 1.62;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.35);
}

.auth-layout__aside {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 5vw, 5rem) clamp(1.5rem, 4vw, 3rem) clamp(0.75rem, 2vw, 1rem);
}

.auth-layout__card {
  margin-left: auto;
}

/* reCAPTCHA v3: badge в углу на странице входа */
.grecaptcha-badge {
  visibility: hidden;
}

.auth-layout .grecaptcha-badge {
  visibility: visible;
  z-index: 5;
}

.login-card {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: saturate(140%) blur(18px);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset,
    0 16px 48px rgba(15, 23, 42, 0.18);
  padding: var(--ruk-gap-3xl);
  max-width: 420px;
  width: 100%;
}

.auth-layout .form-input,
.auth-layout .form-select,
.auth-layout .form-textarea {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.55);
  /* Явный цвет: при data-theme=dark --ruk-ink белый, иначе текст «пропадает» на светлом поле */
  color: #111827;
}

.auth-layout .form-input::placeholder,
.auth-layout .form-select::placeholder,
.auth-layout .form-textarea::placeholder {
  color: #6b7280;
}

.auth-layout .form-input:focus,
.auth-layout .form-select:focus,
.auth-layout .form-textarea:focus {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 122, 255, 0.55);
  color: #111827;
}

.auth-layout .form-label {
  color: rgba(255, 255, 255, 0.98);
}

.auth-layout .form-label-required::after {
  color: #fecaca;
}

.auth-layout .form-help {
  color: rgba(255, 255, 255, 0.9);
}

.auth-layout .form-error {
  color: #fecaca;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.auth-layout .form-checkbox span {
  color: rgba(255, 255, 255, 0.98);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--ruk-gap-2xl);
}

.login-title {
  font-size: var(--ruk-size-xlarge);
  font-weight: var(--ruk-weight-heavy);
  color: rgba(255, 255, 255, 0.98);
  text-align: center;
  margin-bottom: var(--ruk-gap-sm);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
}

/* До lg (1024px): одна колонка — как Tailwind max-lg */
@media (max-width: 1023px) {
  .auth-layout__grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding-top: clamp(1.75rem, 6vw, 2.5rem);
    align-items: start;
  }

  .auth-layout__brand-frame {
    margin-bottom: 1.25rem;
  }

  .auth-layout__brand-svg {
    width: min(100%, 260px);
  }

  .auth-layout__intro {
    padding-bottom: 0.5rem;
    order: 1;
  }

  .auth-layout__aside {
    justify-content: center;
    padding: 0 1.25rem 2.25rem;
    order: 2;
  }

  .auth-layout__card {
    margin-left: 0;
  }
}

/* До md (768px): компактнее карточка, safe-area под вырезы */
@media (max-width: 767px) {
  .auth-layout__grid {
    padding-top: max(1.25rem, env(safe-area-inset-top, 0px));
    gap: 1rem;
  }

  .auth-layout__intro {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-top: 0.5rem;
  }

  .auth-layout__aside {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
  }

  .login-card {
    padding: var(--ruk-gap-xl);
    border-radius: 16px;
    max-width: none;
  }

  .login-logo {
    margin-bottom: var(--ruk-gap-xl);
  }

  .login-title {
    font-size: var(--ruk-size-large);
    line-height: 1.3;
  }
}

/* До sm (640px): узкие телефоны */
@media (max-width: 639px) {
  .auth-layout__brand-svg {
    width: min(100%, 220px);
  }

  .auth-layout__intro-title {
    font-size: clamp(1.1rem, 5vw, 1.35rem);
  }

  .auth-layout__intro-text {
    font-size: clamp(0.875rem, 3.5vw, 1rem);
    line-height: 1.55;
  }

  .login-card {
    padding: var(--ruk-gap-lg);
  }
}

/* Legacy single-column login wrapper (if used elsewhere) */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f2f2f7;
  padding: var(--ruk-gap-xl);
}

.min-h-screen {
  min-height: 100vh;
}

.w-full { width: 100%; }
.h-full { height: 100%; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.m-0 { margin: 0; }
.mt-auto { margin-top: auto; }
.mt-4 { margin-top: var(--ruk-gap-base); }
.mt-12 { margin-top: var(--ruk-gap-4xl); }
.mb-4 { margin-bottom: var(--ruk-gap-base); }
.mb-6 { margin-bottom: var(--ruk-gap-xl); }
.mb-8 { margin-bottom: var(--ruk-gap-2xl); }
.ml-2 { margin-left: var(--ruk-gap-sm); }

.p-0 { padding: 0; }
.p-4 { padding: var(--ruk-gap-base); }
.p-6 { padding: var(--ruk-gap-xl); }

.text-primary { color: var(--ruk-brand-main); }
.text-success { color: var(--ruk-positive); }
.text-warning { color: var(--ruk-caution); }
.text-danger { color: var(--ruk-negative); }
.text-gray-600 { color: var(--ruk-text-tertiary); }
.text-gray-900 { color: var(--ruk-ink); }

.bg-primary { background-color: var(--ruk-brand-main); }
.bg-white { background-color: var(--ruk-canvas); }
.bg-gray-50 { background-color: var(--ruk-surface-1); }
.bg-gray-100 { background-color: var(--ruk-surface-2); }

.rounded { border-radius: var(--ruk-curve-sm); }
.rounded-lg { border-radius: var(--ruk-curve-md); }
.rounded-xl { border-radius: var(--ruk-curve-lg); }
.rounded-full { border-radius: var(--ruk-curve-pill); }

.shadow-sm { box-shadow: var(--ruk-elevation-1); }
.shadow-md { box-shadow: var(--ruk-elevation-2); }
.shadow-lg { box-shadow: var(--ruk-elevation-3); }

@media (max-width: 1279px) {
  .sidebar {
    width: 240px;
  }

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

  /* AppLayout: до xl — выезжающий сайдбар + плавающая кнопка (таблеты «в два окна» тоже) */
  .page-wrapper--with-sidebar .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    width: auto;
    min-width: 44px;
    padding-left: 10px;
    padding-right: 12px;
    border: 0.5px solid rgba(60, 60, 67, 0.14);
    background: rgba(60, 60, 67, 0.06);
  }

  .page-wrapper--with-sidebar .sidebar-toggle:hover {
    background: rgba(60, 60, 67, 0.1);
  }

  .page-wrapper--with-sidebar .sidebar-toggle__label {
    display: inline;
    font-size: 12px;
    font-weight: var(--ruk-weight-demi);
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  /* Очень узкая ширина — только иконка, подпись у плавающей кнопки */
  @media (max-width: 380px) {
    .page-wrapper--with-sidebar .sidebar-toggle__label {
      display: none;
    }

    .page-wrapper--with-sidebar .sidebar-toggle {
      padding-left: 10px;
      padding-right: 10px;
    }
  }

  .page-wrapper--with-sidebar .navbar-menu {
    display: none;
  }

  .page-wrapper--with-sidebar .navbar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--ruk-gap-md);
  }

  .page-wrapper--with-sidebar .navbar-cluster {
    flex: 1;
    min-width: 0;
  }

  .page-wrapper--with-sidebar .navbar-brand {
    min-width: 0;
  }

  .page-wrapper--with-sidebar .brand-text {
    min-width: 0;
  }

  .page-wrapper--with-sidebar .brand-name,
  .page-wrapper--with-sidebar .brand-role {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 56vw;
  }

  .page-wrapper--with-sidebar .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(288px, 86vw);
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding-top: max(var(--ruk-gap-md), env(safe-area-inset-top));
    padding-bottom: max(var(--ruk-gap-sm), env(safe-area-inset-bottom));
    z-index: calc(var(--ruk-layer-overlay) + 3);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    align-self: stretch;
    border-right: 0.5px solid rgba(60, 60, 67, 0.12);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: none;
  }

  .page-wrapper--with-sidebar .sidebar.sidebar--open {
    transform: translateX(0);
    box-shadow: 8px 0 28px rgba(15, 23, 42, 0.22);
    /* Выше шапки (1048), иначе верхние пункты меню, в т.ч. «Главная», оказываются под sticky-header */
    z-index: 1049;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--ruk-layer-overlay) + 2);
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  /* Плотнее иконки справа + короткое имя — не давят на «Меню» */
  .navbar-actions {
    gap: 6px !important;
    flex-shrink: 0;
  }

  .navbar-user__name {
    max-width: 7rem;
  }
}

@media (max-width: 767px) {
  html {
    font-size: 14px;
  }

  .app-layout-main {
    padding: var(--ruk-gap-lg);
    padding-left: max(var(--ruk-gap-lg), env(safe-area-inset-left));
    padding-right: max(var(--ruk-gap-lg), env(safe-area-inset-right));
    padding-bottom: max(var(--ruk-gap-lg), env(safe-area-inset-bottom));
  }

  .container-fluid.app-layout-main {
    padding-left: max(var(--ruk-gap-lg), env(safe-area-inset-left));
    padding-right: max(var(--ruk-gap-lg), env(safe-area-inset-right));
  }

  /* Роли без бокового меню — прежняя колонка в шапке */
  .page-wrapper:not(.page-wrapper--with-sidebar) .navbar {
    flex-direction: column;
    gap: var(--ruk-gap-base);
  }

  .page-wrapper:not(.page-wrapper--with-sidebar) .navbar-menu {
    flex-direction: column;
    width: 100%;
  }

  .grid-cols-3,
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }

  /* Дашборд студента: две карточки в ряд на «широком» телефоне */
  .st-dashboard-stats.grid.grid-cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .widget-header {
    flex-wrap: wrap;
    gap: var(--ruk-gap-sm);
    align-items: flex-start;
  }

  .widget-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .widget-action {
    flex-shrink: 0;
  }

  .table-wrapper {
    overflow-x: scroll;
  }

  .app-layout-main {
    overflow-x: clip;
    max-width: 100%;
    min-width: 0;
  }

  .modal {
    width: 100%;
    max-width: min(560px, calc(100vw - 24px));
    margin: 0 auto;
    max-height: min(88vh, calc(100dvh - 32px));
  }

  .modal-header {
    padding: var(--ruk-gap-lg);
    gap: var(--ruk-gap-sm);
    flex-wrap: wrap;
    align-items: flex-start;
    min-width: 0;
  }

  .modal-title {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    padding-right: var(--ruk-gap-sm);
  }

  .modal-body {
    padding: var(--ruk-gap-lg);
    min-width: 0;
  }

  .modal-footer {
    flex-wrap: wrap;
    justify-content: stretch;
    gap: var(--ruk-gap-sm);
    padding: var(--ruk-gap-md) var(--ruk-gap-lg);
  }

  .modal-footer .btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    min-width: min(160px, 100%);
  }

  .requests-modal {
    max-width: min(520px, calc(100vw - 24px));
  }

  .portfolio-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--ruk-gap-lg);
    padding: var(--ruk-gap-lg);
    min-width: 0;
  }

  .portfolio-meta {
    flex-direction: column;
    gap: var(--ruk-gap-sm);
    align-items: flex-start;
  }

  .portfolio-meta span {
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .portfolio-stats {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--ruk-gap-sm);
  }

  .portfolio-stat {
    flex: 1 1 calc(50% - var(--ruk-gap-sm));
    min-width: 112px;
    box-sizing: border-box;
  }

  .portfolio-name {
    font-size: clamp(1.125rem, 5vw, var(--ruk-size-xxlarge));
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .portfolio-confirm-modal.modal {
    max-width: min(400px, calc(100vw - 24px));
  }

  .requests-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0;
    padding-right: 0;
  }

  .requests-cabinets-grid {
    grid-template-columns: 1fr !important;
  }

  .st-homework-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: var(--ruk-gap-base) !important;
  }

  .st-homework-filters {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .st-homework-filters .btn {
    flex: 1 1 auto;
    min-width: min(120px, 30%);
    justify-content: center;
    box-sizing: border-box;
  }

  .calendar-cell {
    min-height: 76px;
    padding: 6px;
  }

  .calendar-header-cell {
    padding: var(--ruk-gap-sm);
    font-size: var(--ruk-size-micro);
  }

  .calendar-event {
    font-size: 10px;
    padding: 2px 4px;
  }

  .stat-card {
    text-align: center;
  }

  .st-dashboard-page__intro h1 {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
    line-height: 1.25;
    word-break: break-word;
  }

  .st-dashboard-page__intro .text-gray-600 {
    font-size: var(--ruk-size-small);
    line-height: 1.45;
  }
}

@media (max-width: 479px) {
  .st-dashboard-stats.grid.grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 var(--ruk-gap-base); }
  .login-card { padding: var(--ruk-gap-xl); }
  .card-body { padding: var(--ruk-gap-base); }
}

@media print {
  .navbar, .sidebar, .sidebar-backdrop, .app-layout-sidebar, .btn, .dropdown, .modal-backdrop { display: none !important; }
  .card { box-shadow: none; border: 1px solid var(--ruk-border-soft); }
  .page-break { page-break-before: always; }
}

@keyframes rukPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: rukPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes rukBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animate-bounce {
  animation: rukBounce 1s infinite;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ruk-surface-2);
  border-radius: var(--ruk-curve-pill);
}

::-webkit-scrollbar-thumb {
  background: var(--ruk-text-muted);
  border-radius: var(--ruk-curve-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ruk-text-secondary);
}

::selection {
  background: rgba(0, 122, 255, 0.2);
  color: inherit;
}

:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.4);
  outline-offset: 1px;
}

.text-breakable {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.prose {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.prose p,
.prose div,
.prose span {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.content-container {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.whitespace-pre-wrap {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

.student-answer {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
}

/* ===================================
   Brand Logo & Role Label (Navbar)
   =================================== */
.brand-logo {
  height: 34px;
  width: auto;
  max-width: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
}

.brand-logo__img {
  height: 100%;
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: var(--ruk-size-normal);
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-ink);
  letter-spacing: -0.01em;
}

.brand-role {
  font-size: 10px;
  font-weight: var(--ruk-weight-regular);
  color: var(--ruk-text-muted);
  text-transform: none;
  letter-spacing: 0;
}

/* ===================================
   App Footer
   =================================== */
.app-footer {
  background: transparent;
  border-top: none;
  padding: var(--ruk-gap-base) var(--ruk-gap-xl);
  text-align: center;
  font-size: var(--ruk-size-micro);
  color: var(--ruk-text-muted);
}

/* Белая колонка сайдбара визуально продолжается в подвал (иначе резкий срез #fff / #f2f2f7) */
.page-wrapper--with-sidebar .app-footer {
  background: linear-gradient(90deg, #ffffff 0, #ffffff 260px, var(--ruk-page-bg) 260px);
}

@media (max-width: 1279px) {
  .page-wrapper--with-sidebar .app-footer {
    background: linear-gradient(90deg, #ffffff 0, #ffffff 240px, var(--ruk-page-bg) 240px);
  }
}

@media (max-width: 767px) {
  .page-wrapper--with-sidebar .app-footer {
    background: var(--ruk-page-bg);
  }
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ruk-gap-sm);
}

.footer-sep {
  opacity: 0.5;
}

/* ===================================
   iOS-style link accent color
   =================================== */
a {
  color: #007AFF;
}

a:hover {
  color: #0056b3;
}

.ruk-inline-icon {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.2em;
  object-fit: contain;
  display: inline-block;
  margin-right: 0.35em;
}

.btn-icon-img {
  width: 1.1em;
  height: 1.1em;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

/* Внешний SVG как <img> не наследует currentColor — в тёмной теме «чёрный» карандаш */
html[data-theme='dark'] img.btn-icon-img {
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.alert .ruk-alert-icon-wrap {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  line-height: 0;
}

/* Notification Bell */
.notification-bell {
  position: relative;
  cursor: pointer;
  padding: var(--ruk-gap-xs) var(--ruk-gap-sm);
  border-radius: var(--ruk-curve-sm);
  transition: background var(--ruk-motion-quick);
}

.notification-bell:hover {
  background: rgba(60, 60, 67, 0.06);
}

.bell-icon {
  font-size: var(--ruk-size-large);
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bell-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: #FF3B30;
  color: var(--ruk-canvas);
  font-size: 10px;
  font-weight: var(--ruk-weight-heavy);
  min-width: 18px;
  height: 18px;
  border-radius: var(--ruk-curve-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--ruk-canvas);
  line-height: 1;
}

.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--ruk-gap-sm);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  border: none;
  width: 380px;
  max-height: 480px;
  z-index: var(--ruk-layer-popup);
  overflow: hidden;
  animation: rukDropIn var(--ruk-motion-quick);
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.12);
  color: var(--ruk-ink);
}

.notification-empty {
  padding: var(--ruk-gap-2xl);
  text-align: center;
  color: var(--ruk-text-muted);
  font-size: var(--ruk-size-small);
}

.notification-list {
  max-height: 360px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  gap: var(--ruk-gap-md);
  padding: 10px 16px;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
  transition: background 0.15s ease;
  text-decoration: none;
  color: var(--ruk-text-primary);
  cursor: pointer;
}

.notification-item:hover {
  background: rgba(60, 60, 67, 0.04);
  text-decoration: none;
}

.notification-item.unread {
  background: rgba(0, 122, 255, 0.05);
  border-left: none;
}

.notification-icon {
  flex-shrink: 0;
  font-size: var(--ruk-size-large);
  margin-top: 2px;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-text {
  font-size: var(--ruk-size-small);
  color: var(--ruk-ink);
  line-height: 1.4;
}

.notification-time {
  font-size: var(--ruk-size-micro);
  color: var(--ruk-text-muted);
  margin-top: var(--ruk-gap-xs);
}

.notification-dropdown-footer {
  display: block;
  text-align: center;
  padding: 10px;
  border-top: 0.5px solid rgba(60, 60, 67, 0.12);
  font-size: var(--ruk-size-small);
  color: #007AFF;
  font-weight: var(--ruk-weight-book);
}

.notification-dropdown-footer:hover {
  background: rgba(60, 60, 67, 0.04);
  text-decoration: none;
}

@keyframes rukNotifyDropMobile {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Уведомления: на телефоне панель по центру экрана, уже фиксированной ширины */
@media (max-width: 767px) {
  .notification-dropdown {
    position: fixed;
    left: 50%;
    right: auto;
    top: calc(env(safe-area-inset-top, 0px) + 56px);
    margin-top: 0;
    width: min(300px, calc(100vw - 24px));
    max-width: calc(100vw - 16px);
    max-height: min(380px, calc(100dvh - env(safe-area-inset-top, 0px) - 96px));
    transform: translateX(-50%);
    animation: rukNotifyDropMobile var(--ruk-motion-quick);
    z-index: calc(var(--ruk-layer-dialog) + 6);
  }

  .notification-list {
    max-height: min(220px, 38dvh);
  }

  .navbar-user .dropdown-menu--user-actions {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: calc(env(safe-area-inset-top, 0px) + 56px) !important;
    transform: translateX(-50%);
    width: max-content;
    min-width: 0;
    max-width: min(calc(100vw - 24px), 420px);
    z-index: calc(var(--ruk-layer-dialog) + 6);
  }
}

/* Calendar */
.calendar-scroll-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--ruk-gap-xl);
  box-sizing: border-box;
}

.calendar-scroll-wrap .calendar-grid {
  min-width: 540px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: rgba(60, 60, 67, 0.08);
  border: none;
  border-radius: 12px;
  overflow: hidden;
}

.calendar-header-cell {
  background: var(--ruk-surface-2);
  padding: var(--ruk-gap-md);
  text-align: center;
  font-size: var(--ruk-size-small);
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-text-tertiary);
}

.calendar-cell {
  background: var(--ruk-canvas);
  min-height: 100px;
  padding: var(--ruk-gap-sm);
  position: relative;
  transition: background var(--ruk-motion-quick);
  cursor: default;
}

.calendar-cell:hover {
  background: var(--ruk-surface-1);
}

.calendar-cell.other-month {
  background: var(--ruk-surface-1);
  color: var(--ruk-text-muted);
}

.calendar-cell.today {
  background: rgba(0, 122, 255, 0.06);
}

.calendar-day-num {
  font-size: var(--ruk-size-small);
  font-weight: var(--ruk-weight-demi);
  margin-bottom: var(--ruk-gap-xs);
}

.calendar-event {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ruk-canvas);
  cursor: pointer;
  line-height: 1.4;
}

.calendar-event:hover {
  opacity: 0.85;
}

/* Charts container */
.chart-container {
  position: relative;
  width: 100%;
  max-height: 350px;
}

.chart-container canvas {
  max-height: 350px;
}

/* Portfolio */
.portfolio-header {
  display: flex;
  gap: var(--ruk-gap-2xl);
  align-items: flex-start;
  padding: var(--ruk-gap-2xl);
  background: var(--ruk-surface-2);
  border: 1px solid var(--ruk-border-soft);
  border-radius: 16px;
  color: var(--ruk-text-heading);
  box-shadow: var(--ruk-elevation-1);
  margin-bottom: var(--ruk-gap-2xl);
}

.portfolio-avatar {
  width: 88px;
  height: 88px;
  border-radius: var(--ruk-curve-pill);
  background: var(--ruk-surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ruk-size-huge);
  font-weight: var(--ruk-weight-demi);
  flex-shrink: 0;
  border: 2px solid var(--ruk-border-soft);
  color: var(--ruk-text-heading);
}

.portfolio-info {
  flex: 1;
}

.portfolio-name {
  font-size: var(--ruk-size-xxlarge);
  font-weight: var(--ruk-weight-heavy);
  margin-bottom: var(--ruk-gap-sm);
}

.portfolio-meta {
  display: flex;
  gap: var(--ruk-gap-xl);
  flex-wrap: wrap;
  font-size: var(--ruk-size-small);
  color: var(--ruk-text-secondary);
}

html[data-theme='dark'] .portfolio-header .ruk-inline-icon {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.portfolio-stats {
  display: flex;
  gap: var(--ruk-gap-lg);
  margin-top: var(--ruk-gap-lg);
}

.portfolio-stat {
  text-align: center;
  padding: var(--ruk-gap-md) var(--ruk-gap-lg);
  background: var(--ruk-surface-1);
  border: 1px solid var(--ruk-border-soft);
  border-radius: 10px;
}

.portfolio-stat-value {
  font-size: var(--ruk-size-xlarge);
  font-weight: var(--ruk-weight-heavy);
  color: var(--ruk-text-heading);
}

.portfolio-stat-label {
  font-size: var(--ruk-size-micro);
  color: var(--ruk-text-muted);
}

.notification-inline-link {
  margin-left: 4px;
  font-weight: var(--ruk-weight-demi);
  color: var(--ruk-brand-main);
  text-decoration: none;
  white-space: nowrap;
}

.notification-inline-link:hover {
  text-decoration: underline;
}

/* Используется в Student/Schedule/Parsed.vue (раньше через Tailwind) */
@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Переключатель темы (шапка AppLayout): иконки 22px как у уведомлений */
.theme-toggle {
  position: relative;
  cursor: pointer;
  padding: var(--ruk-gap-xs) var(--ruk-gap-sm);
  border: none;
  border-radius: var(--ruk-curve-sm);
  background: transparent;
  transition: background var(--ruk-motion-quick);
  line-height: 0;
}

.theme-toggle:hover:not(:disabled) {
  background: rgba(60, 60, 67, 0.06);
}

.theme-toggle:disabled {
  cursor: wait;
  opacity: 0.55;
}

.theme-toggle__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle__icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.theme-flash {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
}

.theme-flash--dim {
  background: #000;
  opacity: 0;
}

.theme-flash--dim-enter {
  animation: rukThemeDimIn 460ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.theme-flash--dim-exit {
  animation: rukThemeDimOut 460ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes rukThemeDimIn {
  to {
    opacity: 0.84;
  }
}

@keyframes rukThemeDimOut {
  from {
    opacity: 0.84;
  }

  to {
    opacity: 0;
  }
}

/* =============================================================================
   Тёмная тема (первый проход: дашборд + общий каркас при data-theme="dark")
   Фон базы: #191C24. Откат: см. design-backups/pre-dark-dashboard-20260118/
   ============================================================================= */

html[data-theme='dark'] {
  color-scheme: dark;

  --ruk-page-bg: #191c24;
  --ruk-canvas: #1e232d;
  --ruk-surface-1: #232a35;
  --ruk-surface-2: #2a3140;
  --ruk-surface-3: #343d4d;
  --ruk-border-soft: rgba(255, 255, 255, 0.1);

  --ruk-text-muted: #8892a0;
  --ruk-text-secondary: #a8b0bc;
  --ruk-text-tertiary: #94a3b8;
  --ruk-text-primary: #cbd5e1;
  --ruk-text-heading: #e2e8f0;
  --ruk-ink: #f1f5f9;

  --ruk-brand-main: #6ba3ff;
  --ruk-brand-deep: #4f8fff;
  --ruk-brand-bright: #93bfff;
  --ruk-brand-muted: rgba(107, 163, 255, 0.2);

  --ruk-positive: #34d399;
  --ruk-positive-bright: #6ee7b7;
  --ruk-positive-soft: rgba(52, 211, 153, 0.16);

  --ruk-caution: #fbbf24;
  --ruk-caution-bright: #fcd34d;
  --ruk-caution-soft: rgba(251, 191, 36, 0.16);

  --ruk-negative: #f87171;
  --ruk-negative-bright: #fca5a5;
  --ruk-negative-soft: rgba(248, 113, 113, 0.16);

  --ruk-neutral-info: #38bdf8;
  --ruk-neutral-info-bright: #7dd3fc;
  --ruk-neutral-info-soft: rgba(56, 189, 248, 0.16);

  --ruk-mark-excellent: #34d399;
  --ruk-mark-good: #6ba3ff;
  --ruk-mark-satisfactory: #fbbf24;
  --ruk-mark-poor: #f87171;
  --ruk-mark-skip: #94a3b8;
}

html[data-theme='dark'] body {
  background-color: var(--ruk-page-bg);
  color: var(--ruk-text-heading);
}

html[data-theme='dark'] h1,
html[data-theme='dark'] h2,
html[data-theme='dark'] h3,
html[data-theme='dark'] h4,
html[data-theme='dark'] h5,
html[data-theme='dark'] h6 {
  color: var(--ruk-ink);
}

html[data-theme='dark'] a {
  color: var(--ruk-brand-bright);
}

html[data-theme='dark'] a:hover {
  color: var(--ruk-brand-main);
}

html[data-theme='dark'] .header {
  background: rgba(22, 25, 32, 0.88);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: var(--ruk-ink);
}

html[data-theme='dark'] .navbar-brand,
html[data-theme='dark'] .brand-name {
  color: var(--ruk-ink);
}

html[data-theme='dark'] .brand-logo__img {
  filter: invert(1);
  opacity: 0.92;
}

html[data-theme='dark'] .navbar-link {
  color: var(--ruk-text-primary);
}

html[data-theme='dark'] .navbar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ruk-ink);
}

html[data-theme='dark'] .navbar-link.active {
  background: rgba(107, 163, 255, 0.18);
  color: var(--ruk-brand-bright);
}

@media (max-width: 1279px) {
  html[data-theme='dark'] .page-wrapper--with-sidebar .sidebar-toggle {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--ruk-ink);
  }

  html[data-theme='dark'] .page-wrapper--with-sidebar .sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}

html[data-theme='dark'] .navbar-user {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ruk-text-heading);
}

html[data-theme='dark'] .navbar-user span {
  color: var(--ruk-text-heading);
}

html[data-theme='dark'] .theme-toggle:hover:not(:disabled),
html[data-theme='dark'] .notification-bell:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme='dark'] .bell-icon img,
html[data-theme='dark'] .theme-toggle__icon img {
  filter: invert(1);
  opacity: 0.88;
}

html[data-theme='dark'] .notification-badge {
  border-color: var(--ruk-canvas);
}

html[data-theme='dark'] .notification-dropdown {
  background: rgba(28, 33, 42, 0.96);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

html[data-theme='dark'] .notification-dropdown-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: var(--ruk-ink);
}

html[data-theme='dark'] .notification-empty,
html[data-theme='dark'] .notification-item {
  color: var(--ruk-text-secondary);
}

html[data-theme='dark'] .notification-dropdown-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .notification-icon img,
html[data-theme='dark'] .notification-page-icon-wrap img {
  filter: invert(1);
  opacity: 0.88;
}

html[data-theme='dark'] .notification-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme='dark'] .notification-item.unread {
  background: rgba(107, 163, 255, 0.12);
}

html[data-theme='dark'] .notification-item {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

html[data-theme='dark'] .notification-text {
  color: var(--ruk-text-heading);
}

html[data-theme='dark'] .app-layout-sidebar {
  background: #161920;
  border-right-color: rgba(255, 255, 255, 0.08);
}

/* AppLayout: реальный сайдбар — aside.sidebar (не .app-layout-sidebar) */
html[data-theme='dark'] aside.sidebar,
html[data-theme='dark'] .page-wrapper .sidebar {
  background-color: #161920;
  border-right-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .sidebar-inner {
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

html[data-theme='dark'] .app-layout-sidebar-brand {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .sidebar-section-title {
  color: var(--ruk-text-muted);
}

html[data-theme='dark'] .sidebar-link {
  color: var(--ruk-text-primary);
}

html[data-theme='dark'] .sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ruk-ink);
}

html[data-theme='dark'] .sidebar-link.active {
  background: rgba(107, 163, 255, 0.2);
  color: var(--ruk-brand-bright);
  box-shadow: none;
}

html[data-theme='dark'] .sidebar-icon img {
  filter: invert(1);
  opacity: 0.78;
}

html[data-theme='dark'] .sidebar-link.active .sidebar-icon img {
  opacity: 1;
}

html[data-theme='dark'] .app-layout-sidebar-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .app-layout-sidebar-user {
  color: var(--ruk-text-secondary);
}

html[data-theme='dark'] .stat-card,
html[data-theme='dark'] .widget,
html[data-theme='dark'] .card,
html[data-theme='dark'] .table-wrapper {
  background: var(--ruk-canvas);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.06),
    0 8px 28px rgba(0, 0, 0, 0.35);
}

html[data-theme='dark'] .stat-card:hover,
html[data-theme='dark'] .widget:hover {
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.08),
    0 12px 36px rgba(0, 0, 0, 0.42);
}

html[data-theme='dark'] .stat-card-icon.info {
  background: rgba(107, 163, 255, 0.18);
}

/* Те же приёмы, что и для .sidebar-icon: чёрные SVG → светлые на цветном круге */
html[data-theme='dark'] .stat-card-icon img {
  filter: invert(1);
  opacity: 0.9;
}

html[data-theme='dark'] .schedule-card {
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.06),
    0 6px 20px rgba(0, 0, 0, 0.3);
}

html[data-theme='dark'] .schedule-card.current {
  background: rgba(107, 163, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(107, 163, 255, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

html[data-theme='dark'] .table thead {
  background: rgba(35, 42, 53, 0.98);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .table th {
  background: var(--ruk-surface-2);
  color: var(--ruk-ink);
}

html[data-theme='dark'] .table td {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

html[data-theme='dark'] .table tbody tr:hover {
  background: var(--ruk-surface-2);
}

html[data-theme='dark'] .table th:first-child,
html[data-theme='dark'] .table td:first-child {
  background: var(--ruk-canvas);
}

html[data-theme='dark'] .table thead th:first-child {
  background: var(--ruk-surface-2);
}

html[data-theme='dark'] .table tbody tr:hover td:first-child {
  background: var(--ruk-surface-2);
}

html[data-theme='dark'] .card-header,
html[data-theme='dark'] .card-footer {
  background: rgba(26, 31, 40, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .modal-footer {
  background: rgba(26, 31, 40, 0.92);
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .tabs {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .tab-item:hover {
  color: var(--ruk-brand-bright);
}

html[data-theme='dark'] .progress-bar {
  background: linear-gradient(90deg, var(--ruk-brand-deep), var(--ruk-brand-bright));
}

html[data-theme='dark'] .btn-outline {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--ruk-text-heading);
  background: transparent;
}

html[data-theme='dark'] .btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
}

html[data-theme='dark'] .dropdown-menu {
  background: var(--ruk-surface-2);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

html[data-theme='dark'] .dropdown-item {
  color: var(--ruk-text-primary);
}

html[data-theme='dark'] .empty-state-title {
  color: var(--ruk-ink);
}

html[data-theme='dark'] .empty-state-text {
  color: var(--ruk-text-secondary);
}

html[data-theme='dark'] .empty-state-icon img {
  opacity: 0.85;
  filter: invert(1);
}

html[data-theme='dark'] .text-gray-600 {
  color: var(--ruk-text-tertiary);
}

html[data-theme='dark'] .text-gray-900 {
  color: var(--ruk-ink);
}

html[data-theme='dark'] .app-footer {
  color: var(--ruk-text-muted);
}

html[data-theme='dark'] .page-wrapper--with-sidebar .app-footer {
  background: linear-gradient(90deg, #161920 0, #161920 260px, var(--ruk-page-bg) 260px);
}

@media (max-width: 1279px) {
  html[data-theme='dark'] .page-wrapper--with-sidebar .app-footer {
    background: linear-gradient(90deg, #161920 0, #161920 240px, var(--ruk-page-bg) 240px);
  }
}

@media (max-width: 767px) {
  html[data-theme='dark'] .page-wrapper--with-sidebar .app-footer {
    background: var(--ruk-page-bg);
  }
}

html[data-theme='dark'] .btn-primary {
  background: var(--ruk-brand-deep);
  color: #f8fafc;
}

html[data-theme='dark'] .btn-primary:hover {
  background: var(--ruk-brand-main);
  color: #fff;
}

html[data-theme='dark'] .btn-outline:hover {
  background: var(--ruk-brand-deep);
  border-color: var(--ruk-brand-deep);
  color: #f8fafc;
}

html[data-theme='dark'] .alert-warning {
  color: var(--ruk-caution-bright);
}

html[data-theme='dark'] .st-dash-lesson__teacher {
  border-top-color: rgba(255, 255, 255, 0.08);
}
