/* Structural layout, accessibility primitives, and base geometry */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body { margin: 0; min-height: 100vh; overflow-x: clip; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; text-underline-offset: 3px; }
svg { display: inline-block; width: 18px; height: 18px; flex: none; vertical-align: middle; }
h1, h2, h3, p, dl, dd, dt { margin: 0; }
[hidden] { display: none !important; }

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100vh;
  font-size: 14px;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.main {
  grid-column: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.content {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  white-space: nowrap;
}

.nav-short { display: none; }
.mobile-bottom-nav { display: none; }
.mobile-brand { display: none; }

.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.userbox { display: flex; align-items: center; gap: 10px; }

.pagehead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.pagehead > div { min-width: 0; }
.pagehead-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

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

.tabs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 400px;
}
.search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.search input { width: 100%; }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.driver-cell { display: flex; align-items: center; gap: 11px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 4px; }

.panel-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.panel-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.import-input { display: none; }

.bot-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 20px;
  align-items: start;
}
.bot-status-card { position: sticky; top: 88px; }
.bot-state { display: flex; align-items: center; gap: 14px; }
.runtime-list > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  position: relative;
  gap: 16px;
  cursor: pointer;
}
.toggle-row > span:first-child { flex: 1; min-width: 0; }
.toggle-row > input {
  position: absolute;
  right: 0;
  width: 44px;
  height: 26px;
  opacity: 0;
  cursor: pointer;
}

.two-fields { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.token-input { position: relative; }
.password-control { position: relative; }
.combo-control { position: relative; }
.combo-options { position: fixed; inset: auto; margin: 0; z-index: 1000; overflow-y: auto; overscroll-behavior: contain; }

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}
.form-error:empty { display: none; }

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.12fr 1fr;
}
.auth-art {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-right {
  display: grid;
  place-items: center;
}

.avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-avatar { padding: 0; cursor: pointer; }
.avatar-presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.avatar-presets img { display: block; width: 100%; height: auto; border-radius: 50%; }

.found-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
.catalog-viewport { max-height: 560px; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.catalog-viewport thead { position: sticky; top: 0; z-index: 1; }
.catalog-load-status { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.boot-error-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.boot-error-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
