:root {
  --bg: #0b1020;
  --bg-2: #0a0e1c;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.66);
  --stroke: rgba(255, 255, 255, 0.12);
  --accent: #7c5cff;
  --danger: #ff4d67;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  --radius: 16px;
  --radius-sm: 12px;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1000px 700px at 20% 15%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(800px 650px at 85% 12%, rgba(46, 186, 255, 0.10), transparent 60%),
    radial-gradient(900px 700px at 70% 88%, rgba(255, 77, 103, 0.08), transparent 62%),
    var(--bg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(6, 8, 18, 0.65);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.sidebar__logo {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 750;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.92);
  background: radial-gradient(circle at 30% 30%, rgba(124, 92, 255, 0.95), rgba(124, 92, 255, 0.55));
}

.sidebar__name {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav {
  display: grid;
  gap: 6px;
  align-content: start;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.74);
  text-decoration: none;
  border: 1px solid transparent;
}

.nav__item:hover {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.10);
}

.nav__item.is-active {
  color: rgba(255, 255, 255, 0.94);
  background: rgba(124, 92, 255, 0.14);
  border-color: rgba(124, 92, 255, 0.25);
}

.ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: 0.95;
}

.sidebar__footer {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar__meta {
  color: var(--muted);
  font-size: 13px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(8, 10, 21, 0.65);
  backdrop-filter: blur(12px);
}

.topbar__title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search {
  width: min(420px, 50vw);
}

.search__input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.88);
  outline: none;
}

.search__input::placeholder { color: rgba(255, 255, 255, 0.45); }

.search__input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.brand {
  letter-spacing: 0.3px;
  font-weight: 650;
}

.link {
  color: var(--muted);
  text-decoration: none;
}

.link:hover {
  color: var(--text);
}

.content {
  padding: 22px 22px 28px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.page {
  display: grid;
  gap: 16px;
}

.page__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.page__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.2fr 0.8fr;
}

.calendar-page-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
}

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

.card {
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.03));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card__title {
  font-weight: 700;
  margin-bottom: 10px;
}

.h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

.muted {
  margin: 0 0 14px;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.90);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  border-color: rgba(124, 92, 255, 0.30);
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.95), rgba(124, 92, 255, 0.68));
}

.btn--ghost {
  background: transparent;
}

.btn--danger {
  border-color: rgba(255, 77, 103, 0.35);
  background: rgba(255, 77, 103, 0.10);
}

.btn:hover:not(:disabled) {
  filter: brightness(1.04);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.20);
}

.tg-widget {
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 77, 103, 0.35);
  background: rgba(255, 77, 103, 0.12);
  color: rgba(255, 255, 255, 0.92);
}

.import-errors {
  margin: 8px 0 0;
  padding-left: 18px;
}

.import-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
}

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

.import-form {
  display: grid;
  gap: 12px;
}

.import-preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}

.import-preview__list {
  display: grid;
  gap: 8px;
}

.import-preview__row {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.muted--sm {
  font-size: 13px;
  margin: 2px 0 0;
}

.strong { font-weight: 750; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.90);
  font-size: 13px;
}

.table {
  display: grid;
  gap: 10px;
}

.table__head,
.table__row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 120px 190px;
  gap: 12px;
  align-items: center;
}

.targets-table .table__head,
.targets-table .table__row {
  grid-template-columns: minmax(180px, 1.2fr) 130px minmax(180px, 1fr) 90px auto;
}

.table__head {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.70);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.table__row {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.18);
}

.table__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.table__empty {
  padding: 16px 12px;
  color: rgba(255, 255, 255, 0.70);
}

@media (max-width: 900px) {
  .table__head,
  .table__row {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .table__actions {
    justify-content: flex-start;
  }
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.toggle input { display: none; }

.toggle__ui {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}

.toggle__ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  transition: transform 160ms ease;
}

.toggle input:checked + .toggle__ui {
  background: rgba(124, 92, 255, 0.28);
  border-color: rgba(124, 92, 255, 0.40);
}

.toggle input:checked + .toggle__ui::after {
  transform: translateX(18px);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.drawer.is-open { display: block; }

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(520px, 92vw);
  border-left: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(10, 14, 28, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.drawer__title { font-weight: 750; }

.drawer__body {
  padding: 16px;
  overflow: auto;
}

.form {
  display: grid;
  gap: 12px;
}

.form__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
}

.form__title {
  font-weight: 750;
}

.form__header-toggle {
  flex: 0 0 auto;
  padding-top: 1px;
}

.form__row { display: grid; gap: 8px; }

.form__row--inline {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.label {
  font-weight: 650;
  color: rgba(255, 255, 255, 0.86);
}

.input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.90);
  outline: none;
}

.input:focus {
  border-color: rgba(124, 92, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.20);
}

.hint {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.form__actions {
  display: flex;
  gap: 10px;
  padding-top: 6px;
}

.settings-grid {
  display: grid;
  gap: 14px;
}

.settings-form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.16);
}

.settings-list {
  display: grid;
  gap: 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.settings-item__value {
  min-width: 0;
  max-width: min(420px, 52vw);
  overflow-wrap: anywhere;
  text-align: right;
}

@media (max-width: 1000px) {
  .settings-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .settings-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-item__value {
    max-width: 100%;
    text-align: left;
  }
}

.checklist {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}

.check {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 10px;
  align-items: center;
}

.check input { width: 16px; height: 16px; }

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: none;
  max-width: min(560px, 92vw);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.92);
}

.toast.is-show { display: block; }

.toast.is-err {
  border-color: rgba(255, 77, 103, 0.35);
  background: rgba(255, 77, 103, 0.14);
}

@media (prefers-reduced-motion: reduce) {
  .toggle__ui,
  .toggle__ui::after {
    transition: none;
  }
}

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.auth__top {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(8, 10, 21, 0.55);
  backdrop-filter: blur(12px);
}

.auth__brand {
  font-weight: 750;
  letter-spacing: 0.2px;
}

.auth__content {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 26px 22px;
}

.token {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}

.token__label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.token__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.token__input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  outline: none;
}

.token__input:focus {
  border-color: rgba(124, 92, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.20);
}

.token__btn {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.95), rgba(124, 92, 255, 0.72));
  color: rgba(255, 255, 255, 0.94);
  font-weight: 650;
  cursor: pointer;
}

.token__btn:hover {
  filter: brightness(1.04);
}

.kpi {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.kpi:last-child { border-bottom: 0; }

.kpi__label { color: var(--muted); }

.kpi__value {
  font-weight: 650;
  color: rgba(255, 255, 255, 0.90);
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-page {
  gap: 18px;
}

.dashboard-alerts {
  display: grid;
  gap: 12px;
}

.dashboard-alert {
  padding: 16px 18px;
}

.dashboard-alert--critical {
  border-color: rgba(255, 77, 103, 0.42);
  background: linear-gradient(180deg, rgba(255, 77, 103, 0.18), rgba(255, 255, 255, 0.03));
}

.dashboard-alert--warning {
  border-color: rgba(255, 184, 76, 0.38);
  background: linear-gradient(180deg, rgba(255, 184, 76, 0.14), rgba(255, 255, 255, 0.03));
}

.dashboard-alert--ok {
  border-color: rgba(77, 230, 170, 0.28);
  background: linear-gradient(180deg, rgba(77, 230, 170, 0.12), rgba(255, 255, 255, 0.03));
}

.dashboard-alert__meta,
.label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-alert__title,
.dashboard-list__title {
  font-weight: 700;
}

.dashboard-alert__actions,
.dashboard-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dashboard-kpi {
  min-height: 108px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.dashboard-kpi__label {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-kpi__value {
  font-size: 26px;
  font-weight: 750;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dashboard-kpi--danger .dashboard-kpi__value {
  color: #ff9cab;
}

.dashboard-kpi--ok .dashboard-kpi__value {
  color: #93f5c5;
}

.dashboard-layout,
.dashboard-activity-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
}

.dashboard-side-stack {
  display: grid;
  gap: 16px;
}

.dashboard-calendar-card {
  display: grid;
  gap: 14px;
}

.dashboard-calendar__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: -4px;
}

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

.dashboard-day {
  min-height: 86px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.dashboard-day--today {
  box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.55);
}

.dashboard-day--planned {
  background: rgba(124, 92, 255, 0.10);
}

.dashboard-day--critical {
  border-color: rgba(255, 77, 103, 0.4);
  background: rgba(255, 77, 103, 0.10);
}

.dashboard-day__date {
  font-size: 13px;
  font-weight: 750;
}

.dashboard-day__stats {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-calendar__problems {
  display: grid;
  gap: 8px;
}

.dashboard-inline-problem {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 77, 103, 0.18);
  background: rgba(255, 77, 103, 0.08);
}

.dashboard-list {
  display: grid;
  gap: 10px;
}

.dashboard-list__item {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.dashboard-error-text {
  margin-top: 8px;
  color: #ffacb8;
  font-size: 13px;
}

#admin-calendar {
  min-height: 680px;
}

#calendar-side-panel {
  min-height: 320px;
}

.fc {
  --fc-border-color: rgba(255, 255, 255, 0.08);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: rgba(255, 255, 255, 0.03);
  --fc-list-event-hover-bg-color: rgba(255, 255, 255, 0.06);
  --fc-today-bg-color: rgba(124, 92, 255, 0.12);
  color: var(--text);
}

.fc .fc-toolbar-title {
  font-size: 18px;
}

.fc .fc-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: rgba(124, 92, 255, 0.24);
  border-color: rgba(124, 92, 255, 0.32);
}

.fc .fc-scrollgrid,
.fc .fc-theme-standard td,
.fc .fc-theme-standard th,
.fc .fc-list {
  border-color: rgba(255, 255, 255, 0.08);
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
}

.fc .fc-event {
  border: 0;
  padding: 2px 4px;
  cursor: pointer;
}

@media (max-width: 1200px) {
  .dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-layout,
  .dashboard-activity-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dashboard-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-calendar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-day {
    min-height: 74px;
  }
}
