:root {
  color-scheme: dark;
  --bg-main: #020617;
  --bg-soft: rgba(15, 23, 42, 0.66);
  --bg-panel: rgba(15, 23, 42, 0.84);
  --line-soft: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(148, 163, 184, 0.42);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 16px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.34);
  border-radius: 999px;
}

body {
  background: var(--bg-main);
}

.scene-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.22), transparent 35%),
    radial-gradient(circle at 82% 12%, rgba(245, 158, 11, 0.2), transparent 34%),
    radial-gradient(circle at 50% 80%, rgba(34, 197, 94, 0.14), transparent 32%),
    linear-gradient(180deg, #020617 0%, #020617 38%, #030712 100%);
  z-index: 0;
}

.glass {
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  box-shadow: 0 18px 28px rgba(2, 6, 23, 0.4);
}

.panel {
  border: 1px solid var(--line-soft);
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.35);
}

.app-shell {
  position: relative;
}

.app-main {
  min-width: 0;
}

.app-header-wrap {
  position: sticky;
  top: 0;
}

.app-header-shell {
  background:
    linear-gradient(94deg, rgba(2, 6, 23, 0.96) 0%, rgba(3, 16, 39, 0.92) 58%, rgba(30, 16, 40, 0.9) 100%);
  border-bottom: 0;
  box-shadow: none;
}

.app-header-title {
  font-family: "Sora", sans-serif;
  font-size: clamp(1rem, 1.6vw, 1.5rem);
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.2;
}

.app-header-subtitle {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.header-menu-btn {
  border: 1px solid var(--line-soft);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-main);
}

.header-menu-btn:hover {
  border-color: var(--line-strong);
  background: rgba(30, 41, 59, 0.78);
}

@media (min-width: 1024px) {
  .app-shell {
    min-height: 100dvh;
    overflow: hidden;
    border: 0;
    background: rgba(2, 6, 23, 0.42);
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 36px rgba(2, 6, 23, 0.35);
  }

  .app-sidebar {
    border: 0 !important;
    border-right: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background:
      linear-gradient(180deg, rgba(2, 10, 33, 0.96) 0%, rgba(3, 23, 57, 0.9) 55%, rgba(2, 17, 43, 0.92) 100%);
    backdrop-filter: none !important;
  }

  .app-header-shell {
    border-radius: 0;
    border-bottom: 0;
    box-shadow: none;
  }
}

.page-title {
  font-family: "Teko", sans-serif;
  letter-spacing: 0.5px;
  font-size: clamp(2rem, 1.3rem + 2vw, 3rem);
  line-height: 1;
  max-width: 100%;
}

.kpi-number {
  font-family: "Teko", sans-serif;
  letter-spacing: 0.6px;
  font-size: clamp(2.4rem, 2rem + 1vw, 3.6rem);
  line-height: 0.95;
}

.nav-chip {
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.nav-chip:hover {
  transform: translateX(4px);
}

.nav-chip.active {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.25), rgba(14, 116, 144, 0.18));
  border-color: rgba(103, 232, 249, 0.54);
}

.brand-home {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.fade-in {
  animation: fade-in 0.35s ease both;
}

.slide-up {
  animation: slide-up 0.45s ease both;
}

.stagger > * {
  opacity: 0;
  transform: translateY(10px);
  animation: fade-up 0.4s ease forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0.04s; }
.stagger > *:nth-child(2) { animation-delay: 0.08s; }
.stagger > *:nth-child(3) { animation-delay: 0.12s; }
.stagger > *:nth-child(4) { animation-delay: 0.16s; }
.stagger > *:nth-child(5) { animation-delay: 0.2s; }
.stagger > *:nth-child(6) { animation-delay: 0.24s; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge.ok { border-color: rgba(34, 197, 94, 0.6); color: #86efac; }
.badge.warn { border-color: rgba(245, 158, 11, 0.6); color: #fcd34d; }
.badge.bad { border-color: rgba(239, 68, 68, 0.7); color: #fda4af; }
.badge.info { border-color: rgba(56, 189, 248, 0.6); color: #7dd3fc; }

.btn-primary {
  background: linear-gradient(135deg, #06b6d4, #0e7490);
  border: 1px solid rgba(125, 211, 252, 0.4);
  color: #ecfeff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-ghost {
  border: 1px solid var(--line-soft);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-main);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  background: rgba(30, 41, 59, 0.66);
}

.field,
.select,
.textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(2, 6, 23, 0.6);
  color: var(--text-main);
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.75);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

.table-shell {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.table-shell th,
.table-shell td {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 10px;
  text-align: left;
  font-size: 14px;
}

.table-shell th {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.belt-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
}

.belt-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  border: 1px solid var(--line-soft);
  background: rgba(2, 6, 23, 0.9);
  color: var(--text-main);
  border-radius: 12px;
  padding: 10px 12px;
  animation: toast-in 0.3s ease both;
}

.modal-shell {
  width: min(820px, calc(100vw - 24px));
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.94);
  color: var(--text-main);
  padding: 0;
  box-shadow: 0 25px 80px rgba(2, 6, 23, 0.65);
}

.modal-shell::backdrop {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}

.calendar-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.85fr);
  align-items: start;
}

@media (max-width: 1180px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
}

.calendar-month-card {
  padding: 16px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.78));
}

.calendar-month-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-month-title {
  font-family: "Teko", sans-serif;
  letter-spacing: 0.06em;
  font-size: 2rem;
  line-height: 1;
  text-transform: uppercase;
}

.calendar-month-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.calendar-month-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.calendar-week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-week-row span {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  font-weight: 700;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-day-cell {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 8px;
  min-height: 84px;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.calendar-day-cell.current {
  background: rgba(251, 191, 143, 0.12);
}

.calendar-day-cell.outside {
  background: rgba(15, 23, 42, 0.5);
  color: rgba(148, 163, 184, 0.65);
}

.calendar-day-cell:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 211, 252, 0.7);
}

.calendar-day-cell.active {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(248, 113, 113, 0.8);
}

.calendar-day-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-day-number {
  font-size: 14px;
  font-weight: 700;
}

.calendar-day-count {
  font-size: 10px;
  color: rgba(248, 250, 252, 0.72);
}

.calendar-day-dots {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.calendar-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.9);
}

.calendar-day-card {
  padding: 0;
  overflow: hidden;
}

.calendar-day-head {
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.calendar-day-title {
  font-family: "Teko", sans-serif;
  font-size: 1.8rem;
  line-height: 1;
  letter-spacing: 0.04em;
}

.calendar-day-date {
  font-size: 12px;
  margin-top: 3px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.calendar-day-list {
  padding: 12px;
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
}

.calendar-event-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.08);
  border-radius: 12px;
  padding: 12px;
}

.calendar-event-time {
  font-family: "Teko", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
  margin-bottom: 4px;
}

.calendar-event-location {
  font-size: 12px;
  color: var(--text-muted);
}

.calendar-event-description {
  font-size: 12px;
  margin-top: 4px;
  color: rgba(248, 250, 252, 0.87);
}

.calendar-empty {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 1024px) {
  .table-shell {
    min-width: 640px;
  }
}

@media (max-width: 768px) {
  .panel,
  .glass {
    border-radius: 14px;
  }

  .page-title {
    font-size: clamp(1.7rem, 7vw, 2.2rem);
    letter-spacing: 0.02em;
  }

  .app-header-shell {
    border-radius: 0;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .app-header-title {
    font-size: 1rem;
  }

  .kpi-number {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .toast-root {
    left: 10px;
    right: 10px;
    top: 10px;
  }

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

  .modal-shell {
    width: calc(100vw - 12px);
    border-radius: 14px;
  }

  .calendar-month-head {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-month-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .calendar-week-row {
    gap: 4px;
  }

  .calendar-week-row span {
    font-size: 10px;
    letter-spacing: 0.06em;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-day-cell {
    min-height: 62px;
    padding: 6px;
    border-radius: 8px;
  }

  .calendar-day-number {
    font-size: 12px;
  }

  .calendar-day-count {
    font-size: 9px;
  }

  .calendar-day-dots {
    margin-top: 6px;
    gap: 3px;
  }

  .calendar-dot {
    width: 6px;
    height: 6px;
  }

  .calendar-day-head {
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-day-title {
    font-size: 1.55rem;
  }

  .calendar-day-list {
    max-height: none;
    padding: 10px;
  }

  .calendar-event-time {
    font-size: 1.45rem;
  }
}

@media (max-width: 480px) {
  .table-shell {
    min-width: 560px;
  }

  .calendar-day-cell {
    min-height: 56px;
    padding: 5px;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
