:root {
  color-scheme: dark;
  --bg: #090a0d;
  --bg-2: #111318;
  --rail: #121419;
  --pane: #171a20;
  --workspace: #1a1d24;
  --card: #20242d;
  --card-2: #242a35;
  --table-row: #232935;
  --text: #e8edf8;
  --muted: #93a1bd;
  --accent: #6f8eff;
  --accent-strong: #8ba5ff;
  --danger: #ff6d7a;
  --warning: #f0c96b;
  --success: #6dd8a6;
  --border: rgba(154, 175, 224, 0.2);
  --border-strong: rgba(154, 175, 224, 0.32);
  --shadow: rgba(0, 0, 0, 0.4);
  --mono: "IBM Plex Mono", "Consolas", monospace;
  --sans: "Inter", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--sans);
  color: var(--text);
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 255, 255, 0.04), transparent 35%),
    radial-gradient(circle at 92% 6%, rgba(255, 255, 255, 0.03), transparent 30%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 52%, #0d1015 100%);
}

a {
  color: inherit;
}

.app-shell {
  height: 100vh;
  padding: 10px;
  display: grid;
  grid-template-columns: 64px 268px minmax(0, 1fr);
  gap: 10px;
}

.rail,
.side-pane,
.workspace {
  height: calc(100vh - 20px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.01);
  box-shadow: 0 8px 20px var(--shadow);
}

.rail {
  background-color: var(--rail);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.rail-logo {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.rail-nav {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.rail-link {
  width: 44px;
  text-decoration: none;
  border-radius: 4px;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 7px 0;
  display: grid;
  justify-items: center;
  gap: 0;
  position: relative;
  transition: 120ms ease;
}

.rail-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.rail-link.active {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.rail-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(154, 175, 224, 0.28);
  background: rgba(255, 255, 255, 0.03);
}

.rail-icon img {
  width: 14px;
  height: 14px;
  display: block;
  filter: invert(82%) sepia(9%) saturate(324%) hue-rotate(183deg) brightness(96%) contrast(91%);
}

.rail-link.active .rail-icon {
  border-color: rgba(111, 142, 255, 0.7);
}

.rail-link.active .rail-icon img {
  filter: invert(93%) sepia(12%) saturate(468%) hue-rotate(186deg) brightness(98%) contrast(93%);
}

.rail-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.side-pane {
  background-color: var(--pane);
  padding: 14px 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
}

.pane-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.pane-section {
  display: grid;
  gap: 6px;
}

.pane-section h2 {
  margin: 0;
  font-size: 0.68rem;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pane-link {
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.86rem;
  transition: 120ms ease;
  display: block;
}

.pane-link:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.pane-link.active {
  border-color: rgba(111, 142, 255, 0.6);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 2px 0 0 var(--accent);
}

.pane-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.pane-footer {
  margin-top: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.02);
}

.workspace {
  background-color: var(--workspace);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.page-eyebrow {
  margin: 0 0 6px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.66rem;
  color: var(--muted);
}

.page-breadcrumb {
  margin: 0 0 6px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.63rem;
  color: rgba(154, 175, 224, 0.8);
}

.page-title {
  margin: 0;
  font-size: clamp(1.55rem, 1.8vw, 2.05rem);
  letter-spacing: 0;
}

.page-subtitle {
  margin: 8px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.35;
}

.status {
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 200px;
  max-width: 340px;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.workspace-body {
  padding: 12px 18px 16px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.workspace-body::-webkit-scrollbar,
.details-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.workspace-body::-webkit-scrollbar-thumb,
.details-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(154, 175, 224, 0.32);
}

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

.home-grid {
  grid-template-columns: 1fr;
  max-width: 1040px;
}

.user-grid {
  grid-template-columns: minmax(680px, 1.5fr) minmax(370px, 1fr);
}

.room-detail-grid {
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
}

.details-grid {
  grid-template-columns: repeat(3, minmax(250px, 1fr));
}

.card {
  border: 1px solid var(--border);
  background-color: var(--card);
  border-radius: 6px;
  padding: 14px;
  box-shadow: none;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.card h2,
.card-header h2 {
  margin: 0 0 4px;
  font-size: 1.08rem;
  font-weight: 600;
}

.card p,
.card-header p {
  margin: 0;
  color: var(--muted);
}

.nav-card {
  text-decoration: none;
  display: grid;
  gap: 8px;
  padding: 14px;
  transition: transform 120ms ease, border-color 120ms ease;
}

.nav-card h2 {
  margin: 0;
  font-size: 1.08rem;
}

.nav-card:hover {
  transform: translateY(-2px);
  border-color: rgba(111, 142, 255, 0.44);
}

.nav-link {
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--accent-strong);
}

.list-controls {
  margin: 12px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

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

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

input,
select {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.86rem;
  font-family: var(--sans);
}

input:focus,
select:focus {
  outline: 2px solid rgba(111, 142, 255, 0.28);
  border-color: rgba(111, 142, 255, 0.5);
}

select {
  width: auto;
  min-width: 68px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 8px 12px;
  background: #2a2f39;
  color: var(--text);
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: 120ms ease;
  font-size: 0.84rem;
}

.btn:hover {
  background: #343a46;
}

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

.btn.primary {
  background: linear-gradient(160deg, #6f8eff 0%, #5376f8 100%);
  color: #eef3ff;
}

.btn.primary:hover {
  background: linear-gradient(160deg, #7a97ff 0%, #5d7fff 100%);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.btn.ghost.danger-outline {
  border-color: rgba(255, 109, 122, 0.45);
  color: var(--danger);
}

.btn.ghost.danger-outline:hover {
  border-color: rgba(255, 109, 122, 0.7);
  background: rgba(255, 109, 122, 0.12);
}

.form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.form-note {
  margin: 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

#pageLabel,
#roomPageLabel {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.table {
  display: grid;
  gap: 6px;
  overflow: visible;
}

.table-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 4px;
  background: var(--table-row);
  border: 1px solid rgba(154, 175, 224, 0.2);
  overflow: visible;
}

.table-row.header {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 3px 10px 2px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--muted);
}

.table-row.header span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sortable {
  cursor: pointer;
}

.sortable::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-135deg);
  opacity: 0.2;
}

.sortable[data-sort-active='true'][data-sort-dir='asc']::after {
  opacity: 0.8;
  transform: rotate(-135deg);
}

.sortable[data-sort-active='true'][data-sort-dir='desc']::after {
  opacity: 0.8;
  transform: rotate(45deg);
}

.table-row > div,
.table-row > span {
  min-width: 0;
}

#usersTable .table-row {
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.55fr) minmax(0, 0.62fr) minmax(0, auto);
}

#usersTable .table-row.header span:nth-child(1) {
  justify-self: start;
}

#usersTable .table-row.header span:nth-child(2),
#usersTable .table-row.header span:nth-child(3) {
  justify-self: center;
}

#usersTable .table-row.header span:nth-child(4) {
  justify-self: end;
}

#usersTable .table-row > div:nth-child(2),
#usersTable .table-row > div:nth-child(3) {
  justify-self: center;
}

#usersTable .table-row > div:nth-child(4) {
  justify-self: end;
}

.rooms-table .table-row {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.8fr) minmax(0, 0.35fr) minmax(0, 0.6fr) minmax(0, auto);
}

.rooms-table .table-row.header span:nth-child(1),
.rooms-table .table-row.header span:nth-child(2) {
  justify-self: start;
}

.rooms-table .table-row.header span:nth-child(3),
.rooms-table .table-row.header span:nth-child(4),
.rooms-table .table-row.header span:nth-child(5) {
  justify-self: end;
}

.rooms-table .table-row > div:nth-child(3),
.rooms-table .table-row > div:nth-child(4),
.rooms-table .table-row > div:nth-child(5) {
  justify-self: end;
}

.user-meta,
.room-meta {
  display: grid;
  gap: 4px;
}

.display-name {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.user-id,
.room-id {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #a2b0cc;
  word-break: break-all;
}

.table-row.disabled {
  background: rgba(88, 22, 31, 0.28);
  border-color: rgba(255, 109, 122, 0.45);
}

.table-row.disabled .display-name,
.table-row.disabled .user-id {
  color: #ff8d97;
}

.table-row.locked {
  background: rgba(95, 72, 18, 0.26);
  border-color: rgba(240, 201, 107, 0.45);
}

.table-row.locked .display-name,
.table-row.locked .user-id {
  color: #ffd778;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(111, 142, 255, 0.18);
  color: #dbe4ff;
}

.badge.muted {
  background: rgba(154, 175, 224, 0.14);
  color: #bcc9e2;
}

.badge.warning {
  background: rgba(240, 201, 107, 0.26);
  color: #f9dfa3;
}

.room-metric {
  font-family: var(--mono);
  color: #d8e2f8;
  font-size: 0.84rem;
}

.room-metric.stale {
  color: var(--muted);
}

.room-member-btn {
  border: 1px solid rgba(111, 142, 255, 0.45);
  border-radius: 4px;
  background: rgba(111, 142, 255, 0.14);
  color: #dbe5ff;
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 3px 8px;
  cursor: pointer;
}

.room-member-btn:hover {
  background: rgba(111, 142, 255, 0.24);
}

.room-action-btn {
  padding: 6px 10px;
  font-size: 0.78rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.toggle-switch {
  width: 40px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(154, 175, 224, 0.18);
  display: inline-flex;
  align-items: center;
  padding: 1px;
  cursor: pointer;
}

.toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: #f7f9ff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  transform: translateX(0);
  transition: transform 140ms ease;
}

.toggle-switch[data-state='on'] {
  background: rgba(111, 142, 255, 0.45);
  border-color: rgba(139, 165, 255, 0.85);
}

.toggle-switch[data-state='on'] .toggle-thumb {
  transform: translateX(20px);
}

.action-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.action-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-btn {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #d8e4ff;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 700;
}

.info-btn:hover {
  border-color: var(--border-strong);
}

.menu {
  position: relative;
  display: flex;
}

.menu-trigger {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  line-height: 1;
  font-size: 1.15rem;
  padding: 0;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: none;
  min-width: 180px;
  background: #16223a;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 4px;
  z-index: 900;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.42);
}

.menu-panel.open {
  display: grid;
  gap: 4px;
}

.menu-item {
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 3px;
  padding: 7px 8px;
  font-size: 0.82rem;
  font-family: var(--sans);
  cursor: pointer;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.menu-item.danger {
  color: var(--danger);
}

.details-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 6px;
}

.details-item {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 4px;
  padding: 9px 10px;
  display: grid;
  gap: 4px;
}

.details-item strong {
  font-size: 0.86rem;
}

.details-meta {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
}

.details-empty {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 8px 4px;
}

.details-item.room-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.details-item.room-user-row strong {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.details-item.room-user-row .menu {
  margin-left: auto;
  flex: 0 0 auto;
}

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

.info-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.info-item strong {
  color: var(--text);
  text-align: right;
  font-weight: 600;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(6, 10, 19, 0.68);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(460px, 100%);
  display: grid;
  gap: 10px;
  background: #18243d;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 14px;
  box-shadow: 0 34px 60px rgba(0, 0, 0, 0.55);
}

.sessions-modal-card {
  width: min(860px, 100%);
}

.sessions-modal-actions {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.sessions-list {
  max-height: 54vh;
}

.session-confirm-panel {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 109, 122, 0.45);
  background: rgba(88, 22, 31, 0.22);
  border-radius: 4px;
  padding: 10px;
}

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

.session-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.modal-tag {
  margin: 0;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.64rem;
  color: #b5c6ff;
}

.modal-card h3 {
  margin: 0;
}

.modal-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.modal-warning {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(111, 142, 255, 0.16);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #d8e3ff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.hidden {
  display: none;
}

@media (max-width: 1500px) {
  .user-grid {
    grid-template-columns: 1fr;
  }

  .details-grid {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
  }
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: 64px 232px minmax(0, 1fr);
  }

  .workspace-header,
  .workspace-body {
    padding-left: 22px;
    padding-right: 22px;
  }

  .room-detail-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    grid-template-columns: 1fr;
  }

  .rail,
  .side-pane {
    height: auto;
  }

  .rail {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
  }

  .rail-nav {
    display: flex;
    width: auto;
  }

  .rail-link {
    width: 44px;
  }

  .workspace {
    min-height: calc(100vh - 28px);
    height: auto;
  }
}

@media (max-width: 720px) {
  .workspace-header {
    flex-direction: column;
  }

  .status {
    min-width: 0;
    width: 100%;
  }

  .table-row,
  #usersTable .table-row,
  .rooms-table .table-row {
    grid-template-columns: 1fr;
  }

  #usersTable .table-row > div:nth-child(2),
  #usersTable .table-row > div:nth-child(3),
  #usersTable .table-row > div:nth-child(4),
  .rooms-table .table-row > div:nth-child(3),
  .rooms-table .table-row > div:nth-child(4),
  .rooms-table .table-row > div:nth-child(5) {
    justify-self: start;
  }
}

