:root {
  --bg: #edf2f8;
  --bg-2: #e5edf7;
  --panel: #ffffff;
  --panel-soft: #f7faff;
  --line: #d9e2ee;
  --line-strong: #c8d4e5;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0f5fe2;
  --accent-hover: #0f4fc1;
  --danger: #b91c1c;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-xs: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 5px 14px rgba(15, 23, 42, 0.08);
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

body[data-theme="dark"] {
  --bg: #050b17;
  --bg-2: #0a1326;
  --panel: #0f1a2f;
  --panel-soft: #14223b;
  --line: #2a3d5f;
  --line-strong: #3b5685;
  --text: #e8f0ff;
  --muted: #9caecd;
  --accent: #4d8dff;
  --accent-hover: #3577ef;
  --danger: #ff8f8f;
  --success-bg: #133523;
  --success-text: #9aefbf;
  --shadow-xs: 0 2px 6px rgba(2, 6, 23, 0.35);
  --shadow-sm: 0 5px 14px rgba(2, 6, 23, 0.45);
  --shadow: 0 14px 34px rgba(2, 6, 23, 0.55);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 86% -20%, #d7e7ff 0, transparent 42%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

body[data-theme="dark"] {
  background: radial-gradient(circle at 86% -24%, #16305b 0, transparent 40%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.01em;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  align-items: start;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  min-height: calc(100vh - 24px);
  position: sticky;
  top: 12px;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.sidebar-head > div {
  min-width: 0;
}

.sidebar h2 {
  font-size: 1.04rem;
  line-height: 1.2;
}

.sidebar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.user-row {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.user-row #currentUserBadge {
  margin: 0;
  max-width: 176px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.1;
  color: #d8e4f8;
}

.objects-title {
  margin-top: 6px;
}

.user-action-badge {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.14s ease, border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.user-action-badge:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--panel-soft);
  transform: translateY(-1px);
}

.user-action-badge::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 7px;
  border-radius: 7px;
  background: #0f172a;
  color: #fff;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.user-action-badge:hover::after,
.user-action-badge:focus-visible::after {
  opacity: 1;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 12px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(460px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

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

.modal-head .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.sidebar-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.sidebar-controls {
  display: grid;
  gap: 7px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.sidebar-controls .search-label {
  gap: 5px;
}

.sidebar-controls .search-label input {
  min-height: 34px;
  font-size: 0.8rem;
}

.sidebar-controls .sidebar-meta {
  font-size: 0.79rem;
  line-height: 1.2;
}

.objects-selection-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.objects-selection-tools .btn {
  min-height: 30px;
  padding: 4px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  white-space: normal;
  text-align: center;
}

.objects-selection-tools .btn:last-child {
  grid-column: 1 / -1;
}

.search-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
button:focus-visible {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.28);
}

.objects-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 240px;
  max-height: calc(100vh - 300px);
  padding-right: 4px;
}

.objects-list .placeholder {
  padding: 18px 10px;
  font-size: 0.85rem;
}

.list-tail-hint {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 0.74rem;
  text-align: center;
  cursor: pointer;
}

.list-tail-hint:hover {
  border-color: #6fa3f5;
  color: var(--text);
}

.objects-list::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.objects-list::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: #c8d4e5;
  border-radius: 999px;
}

.object-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px;
  background: #fff;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: transform 0.14s ease, border-color 0.18s ease, background-color 0.18s ease;
  box-shadow: var(--shadow-xs);
}

.object-item:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
  transform: translateY(-1px);
}

.object-select {
  margin-top: 2px;
  width: 14px;
  height: 14px;
  accent-color: #0f5fe2;
}

.object-main {
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 0;
  color: inherit;
}

.object-item.active {
  border-color: #93c5fd;
  background: #ecf4ff;
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.22);
}

.object-item .name {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 1px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.object-item .meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.79rem;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 10px 12px;
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(8px);
}

.topbar-main h1 {
  font-size: clamp(0.98rem, 1.6vw, 1.2rem);
}

.breadcrumbs {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.topbar-main small {
  margin-top: 1px;
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 6px;
}

.topbar-filters,
.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
}

.topbar-tools {
  justify-content: flex-end;
  padding-top: 0;
}

.filter-control {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  min-width: 120px;
}

.filter-wide {
  min-width: clamp(190px, 20vw, 300px);
}

.filter-date {
  min-width: 118px;
}

.filter-export {
  min-width: 96px;
}

.filter-density {
  min-width: 100px;
}

.topbar input,
.topbar select {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.78rem;
}

.topbar .btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.78rem;
  box-shadow: var(--shadow-xs);
}

.status-badge {
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.status-badge[data-state="online"] {
  border-color: #16a34a66;
  color: #166534;
}

.status-badge[data-state="degraded"] {
  border-color: #f59e0b66;
  color: #b45309;
}

.status-badge[data-state="offline"] {
  border-color: #ef444466;
  color: #b91c1c;
}

.mobile-only,
.sidebar-close {
  display: none;
}

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-height: 34px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.14s ease, color 0.2s ease;
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--panel-soft);
  border-color: var(--line-strong);
}

.events-card {
  padding: 10px;
}

.events-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.events-header small {
  color: var(--muted);
  text-align: right;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  max-height: calc(100vh - 240px);
  background: #fff;
}

table {
  width: 100%;
  min-width: 740px;
  border-collapse: collapse;
}

.events-table {
  min-width: 700px;
  table-layout: fixed;
}

.events-col-time {
  width: 162px;
}

.events-col-level {
  width: 142px;
}

.events-col-name {
  width: 250px;
}

.events-col-desc {
  width: auto;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.25;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.66rem;
  color: var(--muted);
  background: #f7faff;
}

.events-table tbody td {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.events-table tbody td:nth-child(1) {
  white-space: nowrap;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: #334155;
}

.events-table tbody td:nth-child(2) {
  white-space: nowrap;
}

.events-table tbody td:nth-child(3),
.events-table tbody td:nth-child(4) {
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: #fcfdff;
}

tbody tr:hover {
  background: #f7faff;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #dbeafe;
  background: #eef4ff;
  color: #1e40af;
  font-size: 0.62rem;
  font-family: "JetBrains Mono", monospace;
  padding: 1px 6px;
}

.chip[data-rang="1"] {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.chip[data-rang="2"] {
  background: #ffedd5;
  border-color: #fed7aa;
  color: #9a3412;
}

.chip[data-rang="3"] {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1e40af;
}

.chip[data-rang="4"] {
  background: var(--success-bg);
  border-color: #bbf7d0;
  color: var(--success-text);
}

.chip[data-rang="5"] {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #0f172a;
}

.events-pager {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.events-pager small {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
}

.placeholder {
  color: var(--muted);
  text-align: center;
  padding: 16px 10px;
}

.skeleton-line {
  height: 14px;
  width: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, #d8e3f1 0%, #eef4fb 50%, #d8e3f1 100%);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
  background: linear-gradient(180deg, #eff4fb 0%, #e8eef8 100%);
  padding: 10px;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: min(480px, calc(100vw - 16px));
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 24px clamp(14px, 3.2vw, 26px) 20px;
}

.login-head {
  text-align: center;
  margin-bottom: 14px;
}

.login-head h1 {
  font-size: clamp(1.34rem, 2.3vw, 1.92rem);
  color: #10244d;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.login-head p {
  margin: 7px 0 0;
  color: #6e7c99;
  font-size: clamp(0.9rem, 1vw, 1rem);
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-field-label {
  margin-top: 6px;
  color: #12274e;
  font-size: 0.9rem;
  font-weight: 700;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-icon {
  position: absolute;
  left: 15px;
  color: #7d8db0;
  width: 23px;
  height: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-input-icon svg,
.login-input-action svg {
  width: 21px;
  height: 21px;
}

.login-input-wrap input {
  min-height: 46px;
  border-radius: 12px;
  border-color: #c9d3e4;
  font-size: 0.9rem;
  color: #1d2d52;
  padding-left: 55px;
  padding-right: 52px;
  font-family: "Manrope", sans-serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  background: #fff;
}

.login-input-wrap input::placeholder {
  color: #8d9ab3;
  font-size: 0.86rem;
  font-weight: 500;
}

.login-input-action {
  position: absolute;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #7686a8;
  cursor: pointer;
}

.forgot-password-link {
  justify-self: end;
  border: none;
  background: transparent;
  color: #1f5ed7;
  font-weight: 700;
  font-size: 0.84rem;
  margin-top: 0;
  cursor: pointer;
}

.remember-me-row {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4b5f84;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.remember-me-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #1f5ed7;
}

.login-submit-btn {
  margin-top: 8px;
  min-height: 46px;
  border-radius: 12px;
  font-size: 0.98rem;
  font-weight: 800;
}

.login-footnote {
  margin: 14px auto 0;
  max-width: 360px;
  text-align: center;
  color: #6f7f9e;
  font-size: 0.83rem;
  line-height: 1.42;
}

.login-footnote span {
  color: #1f5ed7;
  font-weight: 700;
}

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

.stack label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.error-text {
  min-height: 1.2em;
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 40;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  min-width: 240px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] .btn-ghost,
body[data-theme="dark"] .object-item,
body[data-theme="dark"] .toast,
body[data-theme="dark"] .status-badge,
body[data-theme="dark"] .modal-card,
body[data-theme="dark"] th {
  background: #12223d;
  color: var(--text);
}

body[data-theme="dark"] input::placeholder {
  color: #7f95b8;
}

body[data-theme="dark"] .topbar,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .events-card,
body[data-theme="dark"] .modal-card {
  border-color: var(--line-strong);
}

body[data-theme="dark"] .btn-ghost {
  border-color: #35527f;
  color: #d8e7ff;
}

body[data-theme="dark"] .btn-ghost:hover {
  background: #1b3458;
  border-color: #4a6ea5;
}

body[data-theme="dark"] th {
  background: #172b48;
  color: #b8c9e8;
}

body[data-theme="dark"] tbody tr:nth-child(even) {
  background: #0f2038;
}

body[data-theme="dark"] tbody tr:hover,
body[data-theme="dark"] .object-item:hover {
  background: #1a3458;
}

body[data-theme="dark"] .object-item.active {
  border-color: #5d89d1;
  background: #1a3154;
  box-shadow: 0 0 0 2px rgba(93, 137, 209, 0.3);
}

body[data-theme="dark"] .events-table tbody td:nth-child(1) {
  color: #b4c8e8;
}

body[data-theme="dark"] .chip {
  background: #213a63;
  border-color: #355b96;
  color: #d8e8ff;
}

body[data-theme="dark"] .chip[data-rang="1"] {
  background: #4a1f2a;
  border-color: #8f3a4e;
  color: #ffd5dc;
}

body[data-theme="dark"] .chip[data-rang="2"] {
  background: #4b3117;
  border-color: #936131;
  color: #ffe1bc;
}

body[data-theme="dark"] .chip[data-rang="3"] {
  background: #21385f;
  border-color: #3e679f;
  color: #d4e6ff;
}

body[data-theme="dark"] .chip[data-rang="4"] {
  background: #193f2d;
  border-color: #2d7a58;
  color: #ccf9e2;
}

body[data-theme="dark"] .chip[data-rang="5"] {
  background: #2a3445;
  border-color: #516178;
  color: #d7e1ee;
}

body[data-theme="dark"] .status-badge[data-state="online"] {
  background: #163a2b;
  border-color: #2e7d5b;
  color: #bdf4da;
}

body[data-theme="dark"] .status-badge[data-state="degraded"] {
  background: #4a3515;
  border-color: #9d6f30;
  color: #ffe3b7;
}

body[data-theme="dark"] .status-badge[data-state="offline"] {
  background: #4a1f28;
  border-color: #92404f;
  color: #ffd2da;
}

body[data-theme="dark"] .skeleton-line {
  background: linear-gradient(90deg, #1a2c4a 0%, #25406a 50%, #1a2c4a 100%);
  background-size: 220% 100%;
}

body.density-compact .topbar {
  padding: 10px 12px;
}

body.density-compact .events-card {
  padding: 10px;
}

body.density-compact .table-wrap {
  max-height: calc(100vh - 250px);
}

body.density-compact .events-table {
  min-width: 660px;
}

body.density-compact th,
body.density-compact td {
  padding: 7px 8px;
}

body.density-compact .events-table tbody td {
  font-size: 0.84rem;
}

body.density-compact .events-table tbody td:nth-child(1) {
  font-size: 0.74rem;
}

body.density-compact .topbar .btn,
body.density-compact .topbar input,
body.density-compact .topbar select,
body.density-compact .status-badge {
  min-height: 32px;
  font-size: 0.78rem;
}

body.density-compact .chip {
  font-size: 0.63rem;
  padding: 1px 6px;
}

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

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1380px) {
  .topbar-tools {
    justify-content: flex-start;
  }
}

@media (max-width: 1120px) {
  .app {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .objects-list {
    min-height: 200px;
    max-height: 260px;
  }

  .topbar-tools {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .app {
    display: block;
    padding: 8px;
  }

  .sidebar {
    position: fixed;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: min(88vw, 380px);
    z-index: 31;
    transform: translateX(-110%);
    transition: transform 0.24s ease;
    padding: 10px;
    min-height: auto;
  }

  .user-row #currentUserBadge {
    max-width: 150px;
  }

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

  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-only {
    display: inline-flex;
  }

  .topbar,
  .events-card {
    padding: 10px;
  }

  .topbar-filters,
  .topbar-tools {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .login-card {
    width: min(460px, calc(100vw - 14px));
    padding: 18px 12px;
    border-radius: 16px;
  }

  .login-head {
    margin-bottom: 12px;
  }

  .login-field-label {
    font-size: 0.88rem;
    margin-top: 5px;
  }

  .login-input-wrap input {
    min-height: 44px;
    font-size: 0.88rem;
  }

  .login-submit-btn {
    min-height: 44px;
    font-size: 0.95rem;
  }

  .forgot-password-link,
  .login-footnote {
    font-size: 0.82rem;
  }

  .remember-me-row {
    font-size: 0.8rem;
  }

  .topbar-filters,
  .topbar-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions .btn,
  .topbar-actions .status-badge,
  .topbar-actions .filter-control {
    width: 100%;
  }

  .events-table {
    min-width: 560px;
  }

  .objects-selection-tools {
    grid-template-columns: 1fr;
  }

  .user-row #currentUserBadge {
    max-width: 130px;
  }

  .events-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .events-header small {
    text-align: left;
  }

  .events-pager {
    flex-direction: column;
    align-items: stretch;
  }

  .events-pager .btn {
    width: 100%;
  }

  .events-pager small {
    text-align: center;
  }

  .table-wrap {
    max-height: calc(100vh - 320px);
  }

  th,
  td {
    padding: 7px 8px;
    font-size: 0.82rem;
  }

  .events-table tbody td:nth-child(1) {
    font-size: 0.74rem;
  }
}
