* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Arial, sans-serif;
}

:root {
  --text: #111;
  --muted: rgba(17, 17, 17, .65);
  --border: rgba(255, 255, 255, .40);
  --surface: rgba(255, 255, 255, .25);
}

body {
  background: linear-gradient(135deg, #cfd9df, #e2ebf0);
  color: var(--text);
  overflow-x: hidden; /* никаких горизонтальных скроллов страницы */
}

a {
  color: inherit;
  text-decoration: none;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100dvh;
  gap: 20px;
  padding: 20px;
}

/* Glass (fallback) */
.sidebar,
.main {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* Sidebar */
.sidebar {
  width: 220px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
}

/* language */
.lang-switch {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.lang-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.40);
  backdrop-filter: blur(10px);
  transition: all .25s ease;
  font-size: 12px;
  font-weight: 800;
  opacity: .7;
}

.lang-btn:hover {
  opacity: 1;
}

.lang-btn.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.85);
}

/* Sidebar nav */
.sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar li {
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 12px;
  transition: all .25s ease;
  user-select: none;
  white-space: nowrap;
}

.sidebar li:hover {
  background: rgba(255, 255, 255, 0.35);
}

.sidebar li.active {
  background: rgba(255, 255, 255, 0.6);
  font-weight: 700;
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 20px;
  gap: 16px;
}

/* Header (fixed inside main) */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.header h1 {
  font-size: 26px;
  font-weight: 800;
}

.search {
  padding: 10px 14px;
  border-radius: 14px;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
  min-width: 240px;
}

.search.hidden {
  display: none;
}

/* Scroll area inside main (so footer stays visible) */
.main-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

/* Pages */
.page {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all .35s ease;
}

.page.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Dashboard cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-top: 10px;
}

/* Generic card */
.card {
  position: relative;
  padding: 22px 24px;
  border-radius: 26px;
  color: #fff;
  overflow: hidden;
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform .35s ease, box-shadow .35s ease;
}

.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
      rgba(255, 255, 255, 0.45),
      rgba(255, 255, 255, 0.05) 40%,
      rgba(255, 255, 255, 0.02));
  opacity: 0.6;
  pointer-events: none;
}

.card span {
  font-size: 14px;
  opacity: 0.9;
}

.card strong {
  font-size: 36px;
  font-weight: 800;
  display: block;
  margin-top: 10px;
}

/* Dashboard gradients only */
.page[data-page="dashboard"] .card:nth-child(1) { background: linear-gradient(135deg, #5b9dff, #3b6cff); }
.page[data-page="dashboard"] .card:nth-child(2) { background: linear-gradient(135deg, #34d399, #10b981); }
.page[data-page="dashboard"] .card:nth-child(3) { background: linear-gradient(135deg, #fb7185, #e11d48); }

.page[data-page="dashboard"] .card:nth-child(1)::after { content: "👤"; }
.page[data-page="dashboard"] .card:nth-child(2)::after { content: "✅"; }
.page[data-page="dashboard"] .card:nth-child(3)::after { content: "⛔"; }

.page[data-page="dashboard"] .card::after {
  position: absolute;
  right: 18px;
  top: 16px;
  font-size: 28px;
  opacity: 0.9;
}

/* Table section */
.table-section {
  padding: 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.table-section h2 {
  margin-bottom: 10px;
  font-weight: 800;
}

.table-wrap {
  width: 100%;
}

/* Desktop table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  font-weight: 800;
  color: #444;
}

tr:not(:last-child) td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Toggle */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 20px;
  background: #e5e7eb;
  cursor: pointer;
  transition: background .25s ease;
  display: inline-block;
  vertical-align: middle;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.toggle.active { background: #34d399; }
.toggle.active::after { transform: translateX(18px); }

.status-text {
  margin-left: 10px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.65);
  font-weight: 700;
}

/* Buttons */
button {
  padding: 8px 14px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  transition: all .25s ease;
}

button:hover {
  background: rgba(255, 255, 255, 0.85);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal.hidden { display: none; }

.modal-content {
  width: 320px;
  max-width: 100%;
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-content h3 {
  font-weight: 800;
  margin-bottom: 5px;
}

.modal-content input,
.modal-content select {
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.7);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Footer */
.footer {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  font-size: 13px;
  opacity: 0.9;
}

.socials {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.socials a {
  opacity: 0.7;
  transition: opacity .25s ease;
}

.socials a:hover { opacity: 1; }

/* =====================
   MOBILE (clean)
===================== */
@media (max-width: 900px) {
  .layout { padding: 14px; gap: 14px; }
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
    min-height: 100dvh;
  }

  .sidebar {
    width: 100%;
    padding: 14px;
    gap: 10px;
  }

  .sidebar-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  /* ВАЖНО: меню без горизонтального скролла — сеткой 2x2 */
  .sidebar ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .sidebar li {
    text-align: center;
    padding: 10px 12px;
    font-size: 14px;
  }

  .main {
    padding: 14px;
    gap: 12px;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search {
    min-width: 0;
    width: 100%;
  }

  .main-scroll {
    padding-right: 0;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Users: table -> cards */
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    padding: 12px;
    margin-top: 12px;
  }
  tr:first-child { margin-top: 0; }

  td {
    border: none !important;
    padding: 10px 8px;
  }

  td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: rgba(0,0,0,0.55);
    font-weight: 800;
    margin-bottom: 6px;
  }

  td.status-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  td.status-cell .left {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .status-text { margin-left: 0; }

  /* action button full width */
  td[data-col="action"] button {
    width: 100%;
  }
}
