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

/* Matrix canvas background */
#matrix-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 0;
  pointer-events: none;
  display: block;
}

body {
  min-height: 100vh;
  font-family: 'Nunito', sans-serif;
  background: #000;
  color: #2a003f;
  overflow-x: hidden;
}

/* Все контентные блоки поверх canvas */
.login-wrap,
.dash {
  position: relative;
  z-index: 1;
}


/* ══ LOGIN ══ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255,255,255,0.9);
  border: 1.5px solid rgba(192,58,255,0.3);
  border-radius: 30px;
  padding: 8px 16px;
  color: #9c4dcc;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: 'Nunito', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
}

.login-back-btn:hover {
  background: #ede0f5;
  transform: translateX(-2px);
  border-color: #c03aff;
  box-shadow: 0 2px 8px rgba(192,58,255,0.2);
}

.login-back-btn:active {
  transform: scale(0.96);
}

.login-card {
  position: relative;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(192,58,255,0.2);
  border-radius: 24px;
  padding: 44px 38px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(192,58,255,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

.login-logo {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  padding: 8px;
  box-sizing: border-box;
  margin: 0 auto 14px;
  display: block;
  border: 2px solid rgba(215, 153, 243, 0.5);
  box-shadow: 0 0 20px rgba(165, 139, 177, 0.4);
  background: rgba(255, 208, 160, 0.5);
}

.login-title {
  font-family: 'Orbitron', monospace;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #c03aff;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 12px;
  color: #a07ab8;
  margin-bottom: 28px;
  letter-spacing: 1px;
}

.login-error {
  background: rgba(255,80,80,0.1);
  border: 1px solid rgba(255,80,80,0.3);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: #c0392b;
  margin-bottom: 16px;
}

.login-input {
  width: 100%;
  background: rgba(255,255,255,0.95);
  border: 1.5px solid rgba(192,58,255,0.25);
  border-radius: 12px;
  padding: 12px 16px;
  color: #2a003f;
  font-size: 14px;
  font-family: 'Nunito', sans-serif;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input::placeholder { color: #c5a8d8; }
.login-input:focus {
  border-color: #c03aff;
  box-shadow: 0 0 0 3px rgba(192,58,255,0.1);
}

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, #c03aff, #7b1fa2);
  border: none;
  border-radius: 12px;
  padding: 13px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  margin-top: 4px;
  transition: filter 0.2s, transform 0.15s;
  box-shadow: 0 4px 18px rgba(192,58,255,0.35);
}
.login-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.login-btn:active { transform: scale(0.97); }

/* ══ DASHBOARD ══ */
.dash {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 16px 80px;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  background: rgba(255,255,255,0.8);
  border-radius: 16px;
  padding: 12px 18px;
  box-shadow: 0 2px 16px rgba(192,58,255,0.1);
  backdrop-filter: blur(10px);
}

.dash-title {
  font-family: 'Orbitron', monospace;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #7b1fa2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  padding: 5px;
  box-sizing: border-box;
  border: 1px solid rgba(240, 209, 255, 0.4);
  background: rgba(255, 249, 242, 1);
}

.logout-btn {
  background: rgba(255,255,255,1);
  border: 1px solid rgba(192,58,255,0.2);
  border-radius: 10px;
  padding: 7px 18px;
  color: #9c4dcc;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  font-family: 'Nunito', sans-serif;
}
.logout-btn:hover { background: #ede0f5; color: #7b1fa2; }

/* Период */
.period-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.tab {
  background: rgba(255,255,255,1);
  border: 1.5px solid rgba(192,58,255,0.18);
  border-radius: 50px;
  padding: 7px 22px;
  color: #9c4dcc;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
}
.tab:hover { background: #ede0f5; color: #7b1fa2; }
.tab.active {
  background: linear-gradient(135deg, #c03aff, #7b1fa2);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(192,58,255,0.3);
}

/* Карточки */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: rgba(255,255,255,1);
  border: 1px solid rgba(192,58,255,0.15);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 2px 16px rgba(192,58,255,0.08);
}

.stat-num {
  font-family: 'Orbitron', monospace;
  font-size: 34px;
  font-weight: 900;
  color: #c03aff;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  color: #a07ab8;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* График */
.chart-wrap {
  background: rgba(255,255,255,1);
  border: 1px solid rgba(192,58,255,0.15);
  border-radius: 18px;
  padding: 20px;
  height: 230px;
  margin-bottom: 22px;
  box-shadow: 0 2px 16px rgba(192,58,255,0.08);
}

/* Таблицы */
.tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.table-block {
  background: rgba(255,255,255,1);
  border: 1px solid rgba(192,58,255,0.15);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 2px 16px rgba(192,58,255,0.08);
}

.table-title {
  font-weight: 700;
  font-size: 13px;
  color: #7b1fa2;
  margin-bottom: 14px;
}

.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stat-table th {
  text-align: left;
  padding: 6px 8px;
  color: #b89acc;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 1.5px solid rgba(192,58,255,0.1);
  text-transform: uppercase;
}

.stat-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(192,58,255,0.07);
  color: #3a1a4a;
  vertical-align: middle;
}

.stat-table tr:last-child td { border-bottom: none; }
.stat-table tr:hover td { background: rgba(192,58,255,0.04); }

.stat-table td.num {
  text-align: right;
  font-weight: 700;
  color: #c03aff;
  white-space: nowrap;
}

/* Ссылка под названием кнопки */
.btn-label { font-weight: 600; color: #3a1a4a; display: block; }
.btn-url {
  font-size: 10.5px;
  color: #9c4dcc;
  text-decoration: none;
  opacity: 0.75;
  word-break: break-all;
  display: block;
  margin-top: 1px;
}
.btn-url:hover { opacity: 1; text-decoration: underline; }

.empty {
  color: #c5a8d8;
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

@media (max-width: 600px) {
  .stat-cards { gap: 8px; }
  .stat-num { font-size: 24px; }
  .tables-row { grid-template-columns: 1fr; }
  .dash { padding: 16px 10px 40px; }
}
