/* M-agenty Exact Layout & Guaranteed Scrollable Containers */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: var(--font);
  color: var(--text);
  background: var(--base);
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; color: inherit; font-size: inherit; }
option { background: var(--surface-1); color: var(--text); }
svg.lucide { width: 16px; height: 16px; flex-shrink: 0; vertical-align: middle; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.app {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* سایدبار دقیقاً به سبک M-agenty */
.side {
  height: 100vh;
  background: var(--sidebar-bg);
  border-inline-end: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  user-select: none;
}
.side-top {
  padding: 12px 12px 8px;
  flex-shrink: 0;
}
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.brand-id {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.brand-id b { font-size: 14px; font-weight: 800; color: #fff; letter-spacing: 0.2px; }

.side-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #16161a;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}
.side-search input {
  background: none;
  border: 0;
  outline: none;
  width: 100%;
  font-size: 12px;
  color: var(--text);
}

/* لیست وسط سایدبار با اسکرول روان */
.nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px;
}
.nav-group {
  font-size: 10.5px;
  color: var(--faint);
  padding: 10px 8px 4px;
  font-weight: 700;
}

/* آیتم بات در سایدبار دقیقاً مثل Brody / GitScout / Emaily در M-agenty */
.bot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .12s;
  margin-bottom: 2px;
}
.bot-item:hover { background: rgba(255,255,255,0.04); }
.bot-item.on { background: #1c1c21; }

/* آیکون مثلثی/برندینگ بات مثل M-agenty */
.maus-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--c, #10b981) 18%, #141417);
  border: 1px solid color-mix(in srgb, var(--c, #10b981) 45%, transparent);
  color: var(--c, #10b981);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
}
.maus-avatar.sm { width: 24px; height: 24px; border-radius: 6px; }
.bot-meta { flex: 1; min-width: 0; }
.bot-row1 { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.bot-name { font-size: 13px; font-weight: 700; color: #f3f3f6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-time { font-size: 10.5px; color: var(--faint); flex-shrink: 0; }
.bot-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.bot-sub.wait { color: #f59e0b; font-weight: 600; }

.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2px;
  transition: .12s;
}
.nav a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav a.on { background: #1c1c21; color: #fff; font-weight: 700; }
.nav a.on svg { color: var(--accent); }

/* فوتر پایین سایدبار دقیقاً مثل Automations / Plugins / User در M-agenty */
.side-foot {
  padding: 6px 8px 10px;
  border-top: 1px solid var(--stroke);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.foot-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  background: none;
  border: 0;
  width: 100%;
  text-align: right;
}
.foot-link:hover, .foot-link.on { background: rgba(255,255,255,0.05); color: #fff; }
.foot-link.mode-btn {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-weight: 700;
  margin-bottom: 4px;
}
.foot-link.mode-btn:hover { background: #10b981; color: #05140e; }

.ucard {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  margin-top: 2px;
}

/* ستون اصلی سمت چپ با اسکرول تضمینی */
.main {
  height: 100vh;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--base);
  overflow: hidden;
}
.top {
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--stroke);
  background: var(--base);
  gap: 10px;
}
.top-left, .top-right { display: flex; align-items: center; gap: 8px; }
.top-title { font-size: 13.5px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }

/* کانتینر اصلی صفحات با اسکرول عمودی آزاد و کامل */
.view {
  flex: 1 1 auto;
  height: calc(100vh - 46px);
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 14px 18px 40px;
}
.view.p-flush {
  padding: 0;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}
