:root {
  --bg: #f8fafc;
  --bg-secondary: #ffffff;
  --panel: #ffffff;
  --card: #ffffff;
  --muted: #64748b;
  --text: #0f172a;
  --text-secondary: #475569;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-light: #dbeafe;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --ok: #059669;
  --err: #dc2626;
  --warn: #d97706;
  --brand-gradient-start: #6d78d2;
  --brand-gradient-end: #7352a9;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.training-visual-experiment {
  --action-start: #6d78d2;
  --action-end: #7352a9;
  --action-gradient: linear-gradient(135deg, var(--action-start) 0%, var(--action-end) 100%);
  --action-shadow: 0 20px 50px rgba(107, 84, 175, 0.28);
  --action-tint: rgba(109, 120, 210, 0.1);
  --action-border: rgba(115, 82, 169, 0.3);
  --action-text: #2b1b73;
  --hero-surface: rgba(255, 255, 255, 0.92);
  --hero-shadow: 0 35px 80px rgba(107, 84, 175, 0.25);
  position: relative;
  background-color: #f7f3ff;
  background-image: radial-gradient(circle at 20% 15%, rgba(109, 120, 210, 0.4), transparent 42%), radial-gradient(circle at 80% 0%, rgba(115, 82, 169, 0.35), transparent 45%), linear-gradient(180deg, #f7f3ff 0%, #f6f2ff 32%, #fbf9ff 65%, #ffffff 100%);
  background-repeat: no-repeat;
  background-attachment: fixed, fixed, scroll;
}

body.training-visual-experiment .layout {
  background: transparent;
}

body.training-visual-experiment .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 240, 255, 0.88));
  border-right: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 30px 60px rgba(107, 84, 175, 0.16);
  backdrop-filter: blur(8px);
}

body.training-visual-experiment .sidebar-header {
  background: transparent;
}

body.training-visual-experiment .sidebar-nav {
  gap: 6px;
}

body.training-visual-experiment .nav-link {
  border-radius: 12px;
  border: 1px solid transparent;
  color: #3b2d78;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.2);
}

body.training-visual-experiment .nav-link:hover,
body.training-visual-experiment .nav-link.active {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(115, 82, 169, 0.35);
  color: #1f1558;
  box-shadow: 0 16px 32px rgba(107, 84, 175, 0.18);
}

body.training-visual-experiment .nav-counter {
  background: rgba(109, 120, 210, 0.18);
  color: #3b2d78;
}

body.training-visual-experiment .nav-profile-info,
body.training-visual-experiment .nav-usage-block {
  border-color: rgba(115, 82, 169, 0.18);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px rgba(107, 84, 175, 0.12);
}

body.training-visual-experiment .main-area {
  background: transparent;
}

body.training-visual-experiment .main-content {
  padding-top: 0;
}

body.training-visual-experiment .training-visual-header {
  padding: 16px 32px 8px;
  min-height: 0;
}

body.training-visual-experiment .training-visual-header .main-title,
body.training-visual-experiment .training-visual-header .main-subtitle,
body.training-visual-experiment .training-visual-header .main-actions {
  display: none;
}

body.training-visual-experiment .menu-toggle {
  border-color: rgba(115, 82, 169, 0.4);
  color: #2b1b73;
  background: rgba(255, 255, 255, 0.72);
}

body.training-visual-experiment .info-icon {
  border-color: rgba(115, 82, 169, 0.3);
  background: rgba(255, 255, 255, 0.85);
  color: #4a3a92;
}

body.training-visual-experiment .info-tooltip {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(115, 82, 169, 0.25);
  box-shadow: 0 20px 40px rgba(107, 84, 175, 0.18);
  color: #2b1b73;
}

body.training-visual-experiment .info-tooltip::before {
  background: rgba(255, 255, 255, 0.95);
  border-left-color: rgba(115, 82, 169, 0.25);
  border-top-color: rgba(115, 82, 169, 0.25);
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 280px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 901px) {
  .sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    min-height: 100vh;
    overflow: visible;
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 5;
  padding-bottom: 8px;
  background: var(--panel);
}

.logo {
  display: inline-flex;
  align-items: center;
}

.logo-image {
  display: block;
  max-width: 135px;
  width: 100%;
  height: auto;
}

.sidebar-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.nav-link.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.nav-counter {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.nav-link--static {
  cursor: default;
  color: var(--text);
  font-weight: 600;
}

.nav-link--static:hover {
  background: none;
  color: var(--text);
}

.nav-profile-info {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-profile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.nav-profile-email {
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-word;
}

.nav-usage-block {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-mobile-warning {
  display: none;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

.nav-usage-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.6px;
}

.nav-usage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-usage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.nav-usage-label-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.nav-usage-label {
  font-weight: 500;
}

.nav-usage-value {
  font-weight: 600;
  color: var(--text);
}

.info-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.info-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  background: #f1f5f9;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.info-icon--small {
  width: 18px;
  height: 18px;
  font-size: 11px;
}

.info-icon:hover,
.info-icon:focus-visible {
  border-color: var(--text-secondary);
  color: var(--text);
  outline: none;
  background: #e5e7eb;
}

.info-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 15;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  min-width: 220px;
}

.info-tooltip[hidden] {
  display: none;
}

.info-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 12px;
  width: 10px;
  height: 10px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.sidebar-nav-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-start;
}

.sidebar-logout {
  width: 100%;
  display: inline-flex;
  justify-content: center;
}

.billing-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.billing-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.billing-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.08);
}

.billing-banner--warning {
  border-color: rgba(220, 38, 38, 0.2);
  background: rgba(220, 38, 38, 0.08);
}

.billing-banner .btn {
  align-self: center;
}

.banner-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.banner-text {
  margin: 0;
  color: var(--text-secondary);
}

.banner-limits {
  margin: 12px 0 0 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 14px;
}

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

.plan-label {
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.plan-name {
  font-size: 24px;
  font-weight: 700;
  margin: 4px 0;
}

.plan-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.plan-price {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.plan-amount {
  font-size: 28px;
  font-weight: 700;
}

.plan-actions {
  display: flex;
  gap: 8px;
}

.plan-subtitle {
  margin: 0;
  color: var(--text-secondary);
}

.limit-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.limit-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.limit-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.limit-title-with-info {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

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

.limit-note {
  font-size: 12px;
  color: var(--text-secondary);
}

.limit-value {
  font-size: 16px;
  font-weight: 600;
}

.limit-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.limit-progress__bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.limit-progress__value {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.limit-progress__hint {
  font-size: 12px;
  color: var(--text-secondary);
}

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

.tariff-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-secondary);
}

.tariff-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.tariff-card h4 {
  margin: 0;
  font-size: 18px;
}

.tariff-subtitle {
  margin: 4px 0 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.tariff-description {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.tariff-meta {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tariff-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tariff-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-old {
  text-decoration: line-through;
  color: var(--text-secondary);
  font-size: 13px;
}

.price-current {
  font-size: 20px;
  font-weight: 700;
}

.empty-hint {
  color: var(--text-secondary);
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: rgba(37, 99, 235, 0.15);
  color: #1d4ed8;
}

.badge--success {
  background: rgba(5, 150, 105, 0.15);
  color: #047857;
}

.badge--error {
  background: rgba(220, 38, 38, 0.15);
  color: #b91c1c;
}

.badge--info {
  background: rgba(147, 197, 253, 0.4);
  color: #1d4ed8;
}

.btn.outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  margin-left: auto;
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.menu-toggle__icon {
  position: relative;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));
  transition: background 0.2s ease;
}

.menu-toggle__icon::before,
.menu-toggle__icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));
  transition: transform 0.2s ease, background 0.2s ease;
}

.menu-toggle__icon::before {
  top: -7px;
}

.menu-toggle__icon::after {
  top: 7px;
}

.layout.menu-open .menu-toggle__icon {
  background: transparent;
}

.layout.menu-open .menu-toggle__icon::before {
  transform: translateY(7px) rotate(45deg);
}

.layout.menu-open .menu-toggle__icon::after {
  transform: translateY(-7px) rotate(-45deg);
}

.menu-toggle__label {
  background: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));
  -webkit-background-clip: text;
  color: transparent;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 32px 32px 16px 32px;
}

.main-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.main-subtitle {
  margin: 8px 0 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.main-subtitle.is-hidden {
  display: none;
}

.main-actions {
  display: flex;
  gap: 12px;
}

.main-content {
  flex: 1;
  padding: 0 32px 32px 32px;
}

.action-link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

.action-link:hover {
  text-decoration: underline;
}

.breadcrumbs {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.breadcrumbs a {
  color: var(--text-secondary);
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.btn {
  padding: 12px 20px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all .2s ease;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn.secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.inactivity-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
}

.inactivity-modal-backdrop.is-visible {
  display: flex;
}

.inactivity-modal {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  text-align: center;
}

.inactivity-modal__title {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.inactivity-modal__text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.inactivity-modal__timer {
  margin: 16px 0;
  font-size: 14px;
  color: var(--warn);
  font-weight: 600;
}

.inactivity-modal__timer span {
  font-variant-numeric: tabular-nums;
}

.inactivity-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.inactivity-modal__actions .btn {
  min-width: 120px;
}

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

  .sidebar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--panel);
    box-shadow: 0 6px 12px -8px rgb(15 23 42 / 0.35);
  }

  .sidebar-header {
    padding-bottom: 0;
  }

  .sidebar-section-label {
    margin-bottom: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .sidebar-nav {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .nav-mobile-warning {
    display: block;
  }

  .layout.menu-open .sidebar-nav {
    display: flex;
  }

  .layout.menu-open .menu-toggle {
    border-color: var(--accent);
    color: var(--accent);
  }

  .layout.menu-open .menu-toggle__icon::before,
  .layout.menu-open .menu-toggle__icon::after {
    background: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));
  }

  .sidebar-nav .nav-link {
    width: 100%;
    justify-content: flex-start;
  }

  .main-header {
    padding: 24px 24px 16px 24px;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .main-actions {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
  }

  .user-section {
    width: 100%;
    justify-content: space-between;
    gap: 12px !important;
  }

  .user-info {
    align-items: flex-start !important;
  }

  .main-content {
    padding: 0 24px 24px 24px;
  }
}
