:root {
  --sidebar-collapsed-width: 64px;
  --sidebar-expanded-width: 240px;
  --sidebar-bg: rgba(15, 23, 42, 0.85);
  --sidebar-hover-bg: rgba(30, 41, 59, 0.92);
  --sidebar-border: rgba(148, 163, 184, 0.1);
  --page-padding: clamp(1.25rem, 2vw, 2.5rem);
  --card-bg: rgba(15, 23, 42, 0.72);
  --card-border: rgba(71, 85, 105, 0.32);
  --card-shadow: 0 24px 48px rgba(15, 23, 42, 0.45);
  --transition-fast: 0.18s ease;
  --transition-medium: 0.28s ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.08), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(129, 140, 248, 0.08), transparent 60%),
    #0f172a;
  color: #e2e8f0;
  transition: background var(--transition-medium);
  overflow-x: hidden;
}

body.has-overlay {
  overflow: hidden;
}

main,
section,
header,
footer,
nav {
  position: relative;
  z-index: 1;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-expanded-width);
  height: 100vh;
  transform: translateX(calc(-1 * (var(--sidebar-expanded-width) - var(--sidebar-collapsed-width))));
  transition: transform var(--transition-medium);
  background: linear-gradient(180deg, var(--sidebar-bg), rgba(15, 23, 42, 0.6));
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 16px 0 48px rgba(15, 23, 42, 0.45);
  z-index: 30;
}

.app-sidebar:hover,
.app-sidebar:focus-within,
body.sidebar-open .app-sidebar {
  transform: translateX(0);
  background: linear-gradient(180deg, var(--sidebar-hover-bg), rgba(30, 41, 59, 0.86));
}

.app-sidebar .sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem 1.25rem 2rem;
  gap: 2.5rem;
}

.app-sidebar .sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}

.app-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.app-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.9rem;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.72;
  transition: opacity var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.app-sidebar nav a .nav-indicator {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.55);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.app-sidebar nav a:hover,
.app-sidebar nav a:focus {
  opacity: 1;
  background: rgba(148, 163, 184, 0.12);
  transform: translateX(6px);
}

.app-sidebar nav a.is-active {
  opacity: 1;
  background: rgba(56, 189, 248, 0.14);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.32);
}

.app-sidebar nav a.is-active .nav-indicator {
  transform: scale(1.4);
  background: rgba(56, 189, 248, 0.85);
}

.app-sidebar nav .nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.app-sidebar nav .nav-group .nav-primary {
  position: relative;
}

.app-sidebar nav .nav-group .nav-secondary {
  display: none;
  font-size: 0.9rem;
  opacity: 0.68;
  padding-left: 2.75rem;
}

.app-sidebar nav .nav-group.nav-group--with-sub:hover .nav-secondary,
.app-sidebar nav .nav-group.nav-group--with-sub:focus-within .nav-secondary {
  display: flex;
}

.app-sidebar nav .nav-group .nav-secondary.is-active {
  display: flex;
  opacity: 1;
}

.sidebar-meta {
  margin-top: auto;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-version {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-version-label {
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
}

.sidebar-version-value {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: #e2e8f0;
}

.sidebar-version-number {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.sidebar-version-date {
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.68);
}

.sidebar-changelog {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.sidebar-changelog-title {
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
}

.sidebar-changelog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.sidebar-changelog-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.9rem;
  padding: 0.75rem 0.9rem;
}

.sidebar-changelog-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.85);
}

.sidebar-changelog-version {
  font-weight: 600;
  color: #f8fafc;
}

.sidebar-changelog-date {
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.75);
}

.sidebar-changelog-item-list {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.82rem;
  line-height: 1.4;
}

.sidebar-changelog-item-list li {
  list-style: disc;
}

.sidebar-changelog-empty {
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.68);
}

.app-sidebar-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
  z-index: 50;
  backdrop-filter: blur(8px);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.app-sidebar-toggle:hover {
  background: rgba(30, 41, 59, 0.88);
  transform: translateY(-1px);
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-collapsed-width);
  padding: var(--page-padding);
  width: 100%;
  transition: margin-left var(--transition-medium), padding var(--transition-medium);
}

body.sidebar-open .app-main {
  margin-left: var(--sidebar-expanded-width);
}

.app-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.app-header .header-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.app-header .header-title {
  font-size: clamp(1.5rem, 2vw, 2.25rem);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.app-header .header-subtitle {
  font-size: 0.95rem;
  color: rgba(148, 163, 184, 0.75);
}

.app-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border-radius: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}

.app-toolbar .toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.app-toolbar .toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 180px;
}

.app-toolbar label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.8);
}

select,
input,
button,
textarea {
  font-family: inherit;
}

.select-input,
input[type='date'],
input[type='text'],
input[type='number'],
textarea,
select {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 1rem;
  color: inherit;
  padding: 0.65rem 1rem;
  transition: border var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.select-input:focus,
input[type='date']:focus,
input[type='text']:focus,
input[type='number']:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

button {
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.9), rgba(59, 130, 246, 0.85));
  color: #f8fafc;
  border-radius: 1rem;
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:hover,
.btn-primary:focus {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.35);
}

.btn-secondary {
  background: transparent;
  color: rgba(226, 232, 240, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1rem;
  padding: 0.65rem 1.3rem;
  font-weight: 500;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: rgba(148, 163, 184, 0.12);
  transform: translateY(-1px);
}

.card-surface {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.75rem;
  box-shadow: var(--card-shadow);
  padding: clamp(1.5rem, 2vw, 2rem);
}

.table-scroll {
  overflow: auto;
  border-radius: 1.25rem;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.team-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.team-list-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: rgba(226, 232, 240, 0.92);
}

.team-list-info small {
  color: rgba(148, 163, 184, 0.6);
  font-size: 0.7rem;
}

.team-list-actions {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.team-action-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.6);
  color: rgba(226, 232, 240, 0.88);
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.team-action-btn:hover,
.team-action-btn:focus {
  border-color: rgba(94, 234, 212, 0.5);
  color: rgba(16, 185, 129, 0.9);
  background: rgba(45, 212, 191, 0.1);
}

.team-action-btn.danger {
  border-color: rgba(248, 113, 113, 0.45);
  color: rgba(248, 113, 113, 0.9);
}

.team-action-btn.danger:hover,
.team-action-btn.danger:focus {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.6);
  color: rgba(254, 202, 202, 0.95);
}

.team-list-empty {
  color: rgba(148, 163, 184, 0.7);
  font-size: 0.85rem;
}

.table-glass {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-glass thead th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(148, 163, 184, 0.75);
  background: rgba(30, 41, 59, 0.88);
  position: sticky;
  top: 0;
  z-index: 5;
}

.table-glass th,
.table-glass td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  padding: 0.9rem 1rem;
}

.table-glass tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.58);
}

.table-glass tbody tr:hover td {
  background: rgba(56, 189, 248, 0.08);
}

.toast-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: none;
  padding-top: 1.75rem;
  z-index: 60;
}

.toast-message {
  min-width: 240px;
  max-width: 360px;
  margin: 0 auto;
  padding: 0.85rem 1.3rem;
  border-radius: 0.95rem;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.45);
  opacity: 0;
  transform: translateY(-12px) scale(0.97);
  transition: opacity var(--transition-medium), transform var(--transition-medium);
}

.toast-message.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-message[data-type='success'] {
  background: rgba(16, 185, 129, 0.92);
  border-color: rgba(16, 185, 129, 0.6);
  color: #ecfdf5;
}

.toast-message[data-type='warning'] {
  background: rgba(234, 179, 8, 0.92);
  border-color: rgba(234, 179, 8, 0.55);
  color: #fef9c3;
}

.toast-message[data-type='error'] {
  background: rgba(244, 63, 94, 0.92);
  border-color: rgba(244, 63, 94, 0.55);
  color: #fff1f2;
}

.loading-mask {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 25, 0.75);
  backdrop-filter: blur(6px);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-medium);
}

.loading-mask.show {
  opacity: 1;
  pointer-events: all;
}

.loading-mask .mask-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 2rem 2.5rem;
  border-radius: 1.5rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.45);
}

.loading-mask .mask-spinner {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.18);
  border-top-color: rgba(56, 189, 248, 0.8);
  animation: spin 0.9s linear infinite;
}

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

.cell-flash {
  animation: cellFlash 1.2s ease;
}

@keyframes cellFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.45);
  }
  40% {
    box-shadow: 0 0 0 12px rgba(56, 189, 248, 0);
  }
  100% {
    box-shadow: none;
  }
}

.login-page {
  overflow: hidden;
  background: radial-gradient(circle at 10% 10%, rgba(14, 165, 233, 0.25), transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(129, 140, 248, 0.25), transparent 55%),
    #0f172a;
}

.login-page::before,
.login-page::after {
  content: '';
  position: fixed;
  width: 140vw;
  height: 140vw;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 90deg,
    rgba(56, 189, 248, 0.25),
    rgba(129, 140, 248, 0.2),
    rgba(236, 72, 153, 0.2),
    rgba(20, 184, 166, 0.2),
    rgba(56, 189, 248, 0.25)
  );
  filter: blur(120px);
  opacity: 0.16;
  animation: loginGlow 18s linear infinite;
  pointer-events: none;
}

.login-page::after {
  opacity: 0.22;
  animation-duration: 26s;
  mix-blend-mode: screen;
}

@keyframes loginGlow {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.login-card {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.55);
  transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.login-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 30px 60px rgba(56, 189, 248, 0.18);
}

@media (max-width: 1024px) {
  .app-main {
    margin-left: var(--sidebar-collapsed-width);
    padding: clamp(1rem, 4vw, 1.75rem);
  }
}

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

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

  .app-sidebar-toggle {
    display: flex;
  }

  .app-main {
    margin-left: 0;
    padding-top: calc(var(--page-padding) + 2.5rem);
  }

  .app-toolbar {
    border-radius: 1.25rem;
  }
}

@media (max-width: 640px) {
  .app-toolbar .toolbar-group {
    width: 100%;
  }

  .app-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
