/* ── RESTAURANT LIST ── */
.r-list {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow:hidden;
}

.r-list-head {
  padding:13px 16px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:11px;
  font-family:'JetBrains Mono',monospace;
  color:var(--text3);
  letter-spacing:1px;
  text-transform:uppercase;
}

.r-list-body {
  padding:8px;
  max-height:600px;
  overflow-y:auto;
}

.r-item {
  display:flex;
  align-items:center;
  gap:9px;
  width:100%;
  padding:10px 12px;
  background:transparent;
  border:1px solid transparent;
  border-radius:var(--radius-sm);
  cursor:pointer;
  color:var(--text2);
  font-size:13.5px;
  font-weight:500;
  transition:all .15s;
  text-align:left;
  margin-bottom:2px;
}

.r-item:hover { background:var(--surface2); color:var(--text); }

.r-item.active {
  background:var(--blue-dim);
  border-color:rgba(59,130,246,.2);
  color:#93c5fd;
}

.r-dot {
  width:7px; height:7px;
  border-radius:50%;
  flex-shrink:0;
}

.on  { background:var(--green); box-shadow:0 0 6px var(--green); }
.off { background:var(--text3); }

.r-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.r-assign-btn {
  padding:4px 8px;
  border:1px solid var(--border2);
  border-radius:var(--radius-xs);
  background:var(--surface2);
  color:var(--text2);
  font-size:12px;
  cursor:pointer;
  transition:all .15s;
  flex-shrink:0;
}

.r-assign-btn:hover { border-color:var(--blue); color:var(--blue); }

/* ─── AGENTS PAGE (mirrors restaurants layout) ─────────────────────────── */
#agents #agentsBrowseMode .r-list-body {
  max-height: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 0;
}
#agents #agentsBrowseMode .r-list-body.list-mode {
  grid-template-columns: 1fr;
  gap: 8px;
}
#agentsBrowseList {
  max-width: none !important;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
#agentsBrowseList .r-list-head {
  display: none;
}
/* Agents list-mode card layout */
#agents #agentsBrowseMode .r-list-body.list-mode .r-item {
  flex-direction: row;
  align-items: center;
  min-height: auto;
  padding: 10px 14px;
  gap: 14px;
}
#agents #agentsBrowseMode .r-list-body.list-mode .r-item-head {
  width: 200px;
  flex-shrink: 0;
}
#agents #agentsBrowseMode .r-list-body.list-mode .r-meta-row {
  flex: 1;
  justify-content: flex-start;
  gap: 6px;
}
#agents #agentsBrowseMode .r-list-body.list-mode .r-preview {
  display: none;
}
#agents #agentsBrowseMode .r-list-body.list-mode .r-open-btn {
  margin-top: 0;
  flex-shrink: 0;
}

/* Split pane: left list + sliding right panel (same as restaurants) */
#agents .split {
  display: block;
  position: relative;
}

#agents #agentsListPane {
  display: block;
  max-width: 900px;
}

#agents #agentsListPane .r-list-body {
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* Right pane: fixed sliding panel like restaurants */
#agents #agentsRightPane {
  position: fixed;
  top: var(--restaurant-panel-top, 56px);
  right: 0;
  width: min(780px, 96vw);
  height: calc(100vh - var(--restaurant-panel-top, 56px));
  z-index: 8520;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 48px rgba(1, 3, 10, 0.64);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#agents #agentsRdetail {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Backdrop for agents detail */
#agentsDetailBackdrop {
  position: fixed;
  top: var(--restaurant-panel-top, 56px);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8500;
  background: rgba(7, 10, 19, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

#agentsDetailBackdrop.show {
  opacity: 1;
  pointer-events: auto;
}

#agents .r-item {
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
  min-height: 156px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

#agents .r-item:hover {
  border-color: var(--accent);
  background: var(--surface2);
}

#agents .r-item.active {
  border-color: var(--accent);
}

#agents .r-item-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

#agents .r-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#agents .r-open-btn {
  margin-top: auto;
}

#agents .r-meta-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

#agents .r-meta-label {
  color: var(--text3);
}

#agents .r-meta-value {
  color: var(--text2);
  text-align: right;
}

#agents .r-preview {
  width: 100%;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.45;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* agentsRightPane display controlled by JS */

/* ─────────────────────────────────────────────────────────────────────────── */
#restaurants.restaurants-browse-mode .split {
  grid-template-columns: 1fr;
}

#restaurants.restaurants-browse-mode:not(.restaurants-detail-mode) #rdetail {
  display: none;
}

#restaurants.restaurants-browse-mode .r-list-body {
  max-height: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  padding: 10px;
}

#restaurants.restaurants-browse-mode .r-item {
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
  min-height: 156px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 12px;
}

#restaurants.restaurants-browse-mode .r-item-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

#restaurants.restaurants-browse-mode .r-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

#restaurants.restaurants-browse-mode .r-open-btn {
  margin-top: auto;
}

#restaurants.restaurants-browse-mode .r-meta-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

#restaurants.restaurants-browse-mode .r-meta-label {
  color: var(--text3);
}

#restaurants.restaurants-browse-mode .r-meta-value {
  color: var(--text2);
  text-align: right;
}

#restaurants.restaurants-browse-mode .r-preview {
  width: 100%;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.45;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#restaurants.restaurants-detail-mode .split {
  grid-template-columns: 1fr;
}

#restaurants.restaurants-detail-mode #restaurantsListPane {
  display: block;
}

.restaurant-detail-backdrop {
  position: fixed;
  top: var(--restaurant-panel-top);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8500;
  background: rgba(7, 10, 19, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.restaurant-detail-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

#restaurants.restaurants-detail-mode #rightPane {
  position: fixed;
  top: var(--restaurant-panel-top);
  right: 0;
  width: min(780px, 96vw);
  height: calc(100vh - var(--restaurant-panel-top));
  z-index: 8520;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 48px rgba(1, 3, 10, 0.64);
  overflow: hidden;
}

#restaurants.restaurants-detail-mode #rdetail {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.agent-detail-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.agent-detail-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.agent-detail-subtitle {
  margin-top: 4px;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.4;
}

.agent-detail-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.agent-detail-close:hover {
  color: var(--text);
  border-color: var(--blue);
}

.agent-detail-tabs {
  display: flex;
  gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  background: var(--surface2);
}

.agent-detail-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #dbe7ff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  padding: 12px 10px 11px;
  border-bottom: 2px solid transparent;
  opacity: 1;
}

.agent-detail-tab.active {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.22);
  border-bottom-color: var(--blue);
}

.agent-detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.agent-detail-content {
  display: none;
}

.agent-detail-content.active {
  display: block;
}

html[dir='rtl'] #restaurants.restaurants-detail-mode #rightPane {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid var(--border);
  box-shadow: 24px 0 48px rgba(1, 3, 10, 0.64);
}

html[dir='rtl'] #agents #agentsRightPane {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid var(--border);
  box-shadow: 24px 0 48px rgba(1, 3, 10, 0.64);
}

.restaurant-back-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.restaurant-back-note {
  font-size: 12px;
  color: var(--text3);
}

